1.1 --- a/epoc32/include/bmpancli.h Tue Nov 24 13:55:44 2009 +0000
1.2 +++ b/epoc32/include/bmpancli.h Tue Mar 16 16:12:26 2010 +0000
1.3 @@ -1,1 +1,179 @@
1.4 -bmpancli.h
1.5 +// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
1.6 +// All rights reserved.
1.7 +// This component and the accompanying materials are made available
1.8 +// under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
1.9 +// which accompanies this distribution, and is available
1.10 +// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
1.11 +//
1.12 +// Initial Contributors:
1.13 +// Nokia Corporation - initial contribution.
1.14 +//
1.15 +// Contributors:
1.16 +//
1.17 +// Description:
1.18 +//
1.19 +
1.20 +
1.21 +#if !defined(__BMPANCLI_H__)
1.22 +#define __BMPANCLI_H__
1.23 +
1.24 +#include <e32base.h>
1.25 +#include <w32std.h>
1.26 +#include <fbs.h>
1.27 +
1.28 +//
1.29 +// CFrameData
1.30 +//
1.31 +
1.32 +
1.33 +/**
1.34 +Encapsulates the information required for one frame of an animation.
1.35 +
1.36 +Each animation frame includes a bitmap that is displayed in a specified position
1.37 +for a specified length of time. You can optionally include a mask that either
1.38 +hides part of the bitmap, or makes part of the bitmap transparent so that the
1.39 +background can be seen.
1.40 +
1.41 +You will probably need to define several frames for a complete animation.
1.42 +When you have defined the frames you require, use CBitmapAnimClientData to
1.43 +construct the animation itself.
1.44 +
1.45 +@publishedAll
1.46 +@released
1.47 +*/
1.48 +class CBitmapFrameData : public CBase
1.49 + {
1.50 +public:
1.51 + IMPORT_C ~CBitmapFrameData();
1.52 + IMPORT_C static CBitmapFrameData* NewL();
1.53 + IMPORT_C static CBitmapFrameData* NewL(CFbsBitmap* aBitmap, CFbsBitmap* aMask=NULL);
1.54 + IMPORT_C static CBitmapFrameData* NewL(CFbsBitmap* aBitmap, CFbsBitmap* aMask, TInt aIntervalInMilliSeconds, TPoint aPosition);
1.55 +//
1.56 + IMPORT_C void SetBitmap(CFbsBitmap* aBitmap);
1.57 + IMPORT_C void SetMask(CFbsBitmap* aMask);
1.58 + IMPORT_C void SetPosition(TPoint aPosition);
1.59 + IMPORT_C void SetInterval(TInt aIntervalInMilliSeconds);
1.60 + IMPORT_C void SetBitmapsOwnedExternally(TBool aOwnedExternally);
1.61 +//
1.62 + IMPORT_C CFbsBitmap* Bitmap() const;
1.63 + IMPORT_C CFbsBitmap* Mask() const;
1.64 + IMPORT_C TInt IntervalInMilliSeconds() const;
1.65 + IMPORT_C TPoint Position() const;
1.66 + IMPORT_C TBool BitmapsOwnedExternally() const;
1.67 +private:
1.68 + CBitmapFrameData();
1.69 +private:
1.70 + CFbsBitmap* iBitmap;
1.71 + CFbsBitmap* iMaskBitmap;
1.72 + TBool iBitmapsOwnedExternally;
1.73 + TInt iIntervalInMilliSeconds;
1.74 + TPoint iPosition;
1.75 + };
1.76 +
1.77 +
1.78 +//
1.79 +// CBitmapAnimClientData
1.80 +//
1.81 +
1.82 +
1.83 +/**
1.84 +Encapsulates one or more animation frames into an entire animation.
1.85 +
1.86 +In addition to specifying the frames you wish to include in your animation,
1.87 +you can also specify:
1.88 +
1.89 +- whether the animation will flash
1.90 +
1.91 +- whether the animation is played once, or continuously
1.92 +
1.93 +- the background frame that is drawn to clear each frame in the animation
1.94 +
1.95 +You can also specify a default frame interval that is used for all frames
1.96 +in an animation. If the interval is already set for any of the individual
1.97 +frames, that takes precedence.
1.98 +
1.99 +When you have defined your animation, use RBitmapAnim to play the animation.
1.100 +
1.101 +@publishedAll
1.102 +@released
1.103 +*/
1.104 +class CBitmapAnimClientData : public CBase
1.105 + {
1.106 +public:
1.107 + /** Animation play mode flags.
1.108 +
1.109 + The animation can be played in any of the ways described below. */
1.110 + enum TPlayMode
1.111 + {
1.112 + /** Plays the animation once, from the first frame to the last one. */
1.113 + EPlay = 0x00,
1.114 + /** Plays the animation from the first frame to the last one continuously. */
1.115 + ECycle = 0x01,
1.116 + /** Plays the animation from the first frame to the last one then from the last
1.117 + frame to the first continuously. */
1.118 + EBounce = 0x02
1.119 + };
1.120 +public:
1.121 + IMPORT_C static CBitmapAnimClientData* NewL();
1.122 + IMPORT_C ~CBitmapAnimClientData();
1.123 +//
1.124 + IMPORT_C void AppendFrameL(CBitmapFrameData* aFrame);
1.125 + IMPORT_C void ResetFrameArray();
1.126 + IMPORT_C void SetBackgroundFrame(CBitmapFrameData* aBackgroundFrame);
1.127 + IMPORT_C void SetFlash(TBool aFlash);
1.128 + IMPORT_C void SetFrameInterval(TInt aFrameIntervalInMilliSeconds);
1.129 + IMPORT_C void SetPlayMode(TPlayMode aPlayMode);
1.130 +//
1.131 + IMPORT_C CBitmapFrameData* BackgroundFrame() const;
1.132 + IMPORT_C TBool Flash() const;
1.133 + IMPORT_C const CArrayPtrFlat<CBitmapFrameData>& FrameArray() const;
1.134 + IMPORT_C TInt FrameIntervalInMilliSeconds() const;
1.135 + IMPORT_C TPlayMode PlayMode() const;
1.136 +//
1.137 + IMPORT_C TInt DurationInMilliSeconds() const;
1.138 + IMPORT_C TSize Size() const;
1.139 +private:
1.140 + CBitmapAnimClientData();
1.141 +private:
1.142 + TBool iFlash;
1.143 + TPlayMode iPlayMode;
1.144 + TInt iFrameIntervalInMilliSeconds;
1.145 + CArrayPtrFlat<CBitmapFrameData> iFrameArray;
1.146 + CBitmapFrameData* iBackgroundFrame;
1.147 + };
1.148 +
1.149 +
1.150 +
1.151 +/**
1.152 +Enables a client to package animation data, and send it to the window server
1.153 +for display.
1.154 +
1.155 +Before using RBitmapAnim, a client must instantiate an RAnimDll. This provides
1.156 +a reference to the window server DLL that runs the animation specified through
1.157 +the RBitmapAnim() object. To complete construction, call ConstructL().
1.158 +
1.159 +@publishedAll
1.160 +@released
1.161 +*/
1.162 +class RBitmapAnim : public RAnim
1.163 + {
1.164 +public:
1.165 + IMPORT_C RBitmapAnim(RAnimDll& aAnimDll);
1.166 + IMPORT_C void ConstructL(const RWindowBase& aWindow);
1.167 + IMPORT_C void DisplayFrameL(TInt aIndex);
1.168 + IMPORT_C void SetBitmapAnimDataL(const CBitmapAnimClientData& aBitmapAnimData);
1.169 + IMPORT_C void SetFlashL(TBool aFlash);
1.170 + IMPORT_C void SetFrameIntervalL(TInt aFrameIntervalInMilliSeconds);
1.171 + IMPORT_C void SetPlayModeL(CBitmapAnimClientData::TPlayMode aPlayMode);
1.172 + IMPORT_C void StartL();
1.173 + IMPORT_C void StopL();
1.174 + IMPORT_C void SetNumberOfCyclesL(TInt aNumberOfCycles);
1.175 + IMPORT_C void SetPositionL(TPoint aPosition);
1.176 +private:
1.177 + void SetAttributesL(const CBitmapAnimClientData& aBitmapAnimData);
1.178 + void SetBackgroundFrameL(const CBitmapFrameData& aFrame);
1.179 + void SetFrameArrayL(const CArrayPtrFlat<CBitmapFrameData>& aFrameArray);
1.180 + void SetFrameL(const CBitmapFrameData& aFrame, TInt aOpCode);
1.181 + };
1.182 +
1.183 +#endif