windowing/windowserver/inc/W32STDGRAPHIC.H
changeset 0 5d03bc08d59c
child 101 8b609b439da2
equal deleted inserted replaced
-1:000000000000 0:5d03bc08d59c
       
     1 // Copyright (c) 2005-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 // Standard CWsGraphic plugins
       
    15 // 
       
    16 //
       
    17 
       
    18 #ifndef __W32STDGRAPHIC_H__
       
    19 #define __W32STDGRAPHIC_H__
       
    20 
       
    21 #include <w32std.h>
       
    22 #include <icl/imagedata.h>
       
    23 	
       
    24 class TWsGraphicAnimation: public TWsGraphicMsgFixedBase
       
    25 /** data attached to a CWindowGc::DrawWsGraphic to allow the artwork to understand VCR-style
       
    26 	play-stop-pause commands.
       
    27 	@publishedAll
       
    28 	@released
       
    29 */	{
       
    30 public:
       
    31 	enum
       
    32 		{
       
    33 		ETypeId = 0x10281AB1
       
    34 		};
       
    35 	IMPORT_C TWsGraphicAnimation();
       
    36 	IMPORT_C void Play(TBool aLoop);
       
    37 	IMPORT_C void Pause();
       
    38 	IMPORT_C void Stop(TBool aImmediately);
       
    39 	IMPORT_C TBool IsPlaying() const;
       
    40 	IMPORT_C TBool IsStopped() const;
       
    41 	IMPORT_C TBool IsStopping() const;
       
    42 	IMPORT_C TBool IsPaused() const;
       
    43 	IMPORT_C TBool Loops() const;
       
    44 private:
       
    45 	TUint State() const;
       
    46 	void SetState(TUint aState);
       
    47 private:
       
    48 	enum 
       
    49 		{
       
    50 		// animation state in lowest nibble
       
    51 		EStopped	= 0x00,
       
    52 		EPlaying	= 0x01,
       
    53 		EStopping	= 0x02,
       
    54 		EPaused		= 0x03,
       
    55 		EStateMask	= 0x0F,
       
    56 		// other flags above
       
    57 		ELoop		= 0x10,
       
    58 		};
       
    59 	TUint iFlags;
       
    60 	TTime iPlay;
       
    61 	TTime iPauseOrStopping;
       
    62 	};
       
    63 
       
    64 NONSHARABLE_CLASS(CWsGraphicBitmap): public CWsGraphic
       
    65 /** Client representation of a window-server-side CFbsBitmap owned by this Client
       
    66 
       
    67 @publishedAll
       
    68 @released
       
    69 */
       
    70 	{
       
    71 public:
       
    72 	IMPORT_C static CWsGraphicBitmap* NewL(const CFbsBitmap* aBitmap,const CFbsBitmap* aMask);
       
    73 	IMPORT_C static CWsGraphicBitmap* NewL(TUid aUid,const CFbsBitmap* aBitmap,const CFbsBitmap* aMask);
       
    74 	IMPORT_C static CWsGraphicBitmap* NewL(const TWsGraphicId& aReplace,const CFbsBitmap* aBitmap,const CFbsBitmap* aMask);
       
    75 	IMPORT_C ~CWsGraphicBitmap();
       
    76 public: // protected virtuals from CWsGraphic promoted to public
       
    77 	IMPORT_C TInt ShareGlobally();
       
    78 	IMPORT_C TInt UnShareGlobally();
       
    79 	IMPORT_C TInt Share(TSecureId aClientId);
       
    80 	IMPORT_C TInt UnShare(TSecureId aClientId);
       
    81 private:
       
    82 	CWsGraphicBitmap();
       
    83 	void HandleMessage(const TDesC8& aData);
       
    84 	void OnReplace();
       
    85 };
       
    86 
       
    87 NONSHARABLE_CLASS(CWsGraphicBitmapAnimation): public CWsGraphic
       
    88 /** Client representation of a window-server-side CFbsBitmap owned by this Client
       
    89 
       
    90 @publishedAll
       
    91 @released
       
    92 */
       
    93 	{
       
    94 public:
       
    95 	NONSHARABLE_CLASS(CFrame): public CBase
       
    96 		{
       
    97 	public:
       
    98 		IMPORT_C static CFrame* NewL();
       
    99 		IMPORT_C ~CFrame();
       
   100 		// public getters/setters
       
   101 		IMPORT_C TFrameInfo FrameInfo() const;
       
   102 		IMPORT_C void SetFrameInfo(const TFrameInfo& aFrameInfo);
       
   103 		IMPORT_C const CFbsBitmap* Bitmap() const;
       
   104 		IMPORT_C void SetBitmap(CFbsBitmap* aBitmap);
       
   105 		IMPORT_C const CFbsBitmap* Mask() const;
       
   106 		IMPORT_C void SetMask(CFbsBitmap* aMask);
       
   107 	private:
       
   108 		CFrame();
       
   109 	private:
       
   110 		friend class CWsGraphicBitmapAnimation;
       
   111 		TFrameInfo iFrameInfo;
       
   112 		CFbsBitmap* iBitmap;
       
   113 		CFbsBitmap* iMask;
       
   114 		};
       
   115 	typedef TArray<CFrame*> TFrames;
       
   116 public:
       
   117 	IMPORT_C static CWsGraphicBitmapAnimation* NewL(const TFrames& aFrames);
       
   118 	IMPORT_C static CWsGraphicBitmapAnimation* NewL(TUid aUid,const TFrames& aFrames);
       
   119 	IMPORT_C static CWsGraphicBitmapAnimation* NewL(const TWsGraphicId& aReplace,const TFrames& aFrames);
       
   120 	IMPORT_C ~CWsGraphicBitmapAnimation();
       
   121 public: // protected virtuals from CWsGraphic promoted to public
       
   122 	IMPORT_C TInt ShareGlobally();
       
   123 	IMPORT_C TInt UnShareGlobally();
       
   124 	IMPORT_C TInt Share(TSecureId aClientId);
       
   125 	IMPORT_C TInt UnShare(TSecureId aClientId);
       
   126 private:
       
   127 	CWsGraphicBitmapAnimation();
       
   128 	static HBufC8* PackLC(const TFrames& aFrames);
       
   129 	void HandleMessage(const TDesC8& aData);
       
   130 	void OnReplace();
       
   131 };
       
   132 
       
   133 #endif //__W32STDGRAPHIC_H__