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