os/graphics/windowing/windowserver/nonnga/SERVER/ANIM.H
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
sl@0
     1
// Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
// Definition of classes related to Anim DLL's
sl@0
    15
// 
sl@0
    16
//
sl@0
    17
sl@0
    18
#ifndef __ANIM_H__
sl@0
    19
#define __ANIM_H__
sl@0
    20
sl@0
    21
#include <e32std.h>
sl@0
    22
#include <w32adll.h>
sl@0
    23
#include "server.h"
sl@0
    24
#include "sprite.h"
sl@0
    25
sl@0
    26
class CWsAnimDll : public CWsObject
sl@0
    27
	{
sl@0
    28
public:
sl@0
    29
	static void InitStaticsL();
sl@0
    30
	static void DeleteStatics();
sl@0
    31
public:
sl@0
    32
	CWsAnimDll(CWsClient *owner);
sl@0
    33
	~CWsAnimDll();
sl@0
    34
	TInt CreateInstanceL(TUint32 aHandle, TInt aType, TAny *aArgs, TBool aIsWindow);
sl@0
    35
	void LoadL(const TDesC &aDllName);
sl@0
    36
	void CommandL(TInt aOpcode, const TAny *aCmdData);
sl@0
    37
	void Remove(TInt aHandle);
sl@0
    38
	inline TInt AnimObjectHandle(CWsAnim *aAnimObject) const;
sl@0
    39
	inline CWsAnim* AnimObjectL(TInt aAnimHandle) const;
sl@0
    40
	
sl@0
    41
private:
sl@0
    42
	TInt doCreateInstanceL(CWsAnim *aInstance, TInt aType, TAny *aArgs, TBool aIsWindow);
sl@0
    43
private:
sl@0
    44
	static CObjectConIx *AnimObjectConIx;
sl@0
    45
private:
sl@0
    46
	CObjectCon *iInstanceCon;
sl@0
    47
	CObjectIx *iInstanceIndex;
sl@0
    48
	CAnimDll *iAnimDll;
sl@0
    49
	RLibrary iAnimLib;
sl@0
    50
	
sl@0
    51
public:
sl@0
    52
	TSglQueLink iQue;
sl@0
    53
	};
sl@0
    54
	
sl@0
    55
class CWsAnimGc;
sl@0
    56
sl@0
    57
class CWsAnim : public CObject, public MAnimGeneralFunctions, public MAnimGeneralFunctionsWindowExtension,
sl@0
    58
													public MAnimFreeTimerWindowFunctions, public MAnimSpriteFunctions, public MAnimGeneralFunctionsEventExtension
sl@0
    59
	{
sl@0
    60
public:
sl@0
    61
	static void InitStaticsL();
sl@0
    62
	static void DeleteStatics();
sl@0
    63
public:
sl@0
    64
	CWsAnim(CWsAnimDll *aDll);
sl@0
    65
	~CWsAnim();
sl@0
    66
	void Connect(CWsClientWindow *aWindow);
sl@0
    67
	void Connect(CWsSprite *aSprite);
sl@0
    68
	void ConstructL(CAnim *aAnim, TAny *aArgs, CWsAnimDll *aAnimDll, TBool aIsWindow);
sl@0
    69
	void Redraw(CFbsBitGc * aGc, const TRegion *aRegion);
sl@0
    70
	static void UserDeactivateAnimGc();
sl@0
    71
	inline CAnim *Anim() const;
sl@0
    72
	static void WindowClosing(CWsAnim *aWsAnim);
sl@0
    73
	static void CloseAnim(CWsAnim *aWsAnim);
sl@0
    74
	const TRect& Rect() const;
sl@0
    75
	TRect BestRect() const;
sl@0
    76
	void FocusChanged(TBool aNewFocusState);
sl@0
    77
	void SetMessage(const RMessagePtr2* aMessage);
sl@0
    78
	TInt CommandReply(TInt aOpcode, TAny* aArgs);
sl@0
    79
// Functions from MAnimGeneralFunctions
sl@0
    80
	TDateTime SystemTime() const;
sl@0
    81
	TBool FlashStateOn() const;				// Return ETrue if in the on part of the flash cycle
sl@0
    82
	void Panic() const;
sl@0
    83
	void Panic(TClientPanic aPanic) const;
sl@0
    84
	const CFbsScreenDevice *ScreenDevice();						// Pointer to screen device
sl@0
    85
	CFbsBitmap *DuplicateBitmapL(TInt aHandle);
sl@0
    86
	CFbsFont *DuplicateFontL(TInt aHandle);
sl@0
    87
	void CloseFont(CFbsFont *);
sl@0
    88
	TAnimSync Sync() const;					// Return the current sync mode
sl@0
    89
	void Animate(TDateTime *aDateTime);		// Trigger a call to the DLL's Animate function
sl@0
    90
	void SetSync(TAnimSync aSyncMode);
sl@0
    91
	void SetInterval(TInt aInterval);		// Set the regular repeat interval, does not affect the current countdown
sl@0
    92
	void SetNextInterval(TInt aInterval);	// Sets the interval to the next Animate, after that it will fall back to the usual rate
sl@0
    93
	const RThread &Client();				// Return a reference to the calling clients thread
sl@0
    94
	void ReplyBuf(const TDesC8 &aDes);
sl@0
    95
	void ReplyBuf(const TDesC16 &aDes);
sl@0
    96
	void GetRawEvents(TBool aGetEvents) const;	// Raw events are passed to CAnim::OfferRawEventL
sl@0
    97
	void PostRawEvent(const TRawEvent &aRawEvent) const;
sl@0
    98
	void PostKeyEvent(const TKeyEvent &aRawEvent) const;
sl@0
    99
	const RMessagePtr2* Message();
sl@0
   100
	TAny* ExtendedInterface(TInt aInterface);
sl@0
   101
	TInt RegisterForNotifications(TUint32 aNotifications);
sl@0
   102
sl@0
   103
// Functions from MAnimGeneralFunctionsWindowExtension
sl@0
   104
	TInt Screens() const;
sl@0
   105
	TInt FocusScreens() const;
sl@0
   106
	void SetFocusScreen(TInt aScreenNo);
sl@0
   107
	TInt WindowGroups(TInt aScreen) const;
sl@0
   108
	TBool WindowGroupInfo(TWindowGroupInfo& aInfo,TInt aScreen,TInt aWindowGroup) const;
sl@0
   109
	TBool WindowGroupName(TPtrC& aWindowName,TInt aScreen,TInt aWindowGroup) const;
sl@0
   110
	TInt SetOrdinalPosition(TInt aWindowGroupId,TInt aPos,TInt aOrdinalPriority);
sl@0
   111
	void WindowConfig(TWindowConfig& aWindowConfig) const;	
sl@0
   112
// Functions from MAnimWindowFunctions
sl@0
   113
	void ActivateGc();	// Activate the GC to enable drawing in a command or animate function
sl@0
   114
	void Invalidate(const TRect &aRect);
sl@0
   115
	void Parameters(TWindowInfo &aData);
sl@0
   116
	void VisibleRegion(TRegion& aRegion);
sl@0
   117
 	TSize WindowSize() const;				// Return the window size
sl@0
   118
	TBool IsHidden();
sl@0
   119
	void SetVisible(TBool aState);
sl@0
   120
	void SetRect(const TRect &aRect);		// Sets the rect that this instance wants to draw to.
sl@0
   121
// Functions from MAnimFreeTimerWindowFunctions
sl@0
   122
	void DeactivateGc();					// Deactivate the GC after drawing from our own RunL
sl@0
   123
	void Update();
sl@0
   124
// Functions from MAnimSpriteFunctions
sl@0
   125
	TSpriteMember *GetSpriteMember(TInt aMember) const;	//Returns sprite member data
sl@0
   126
	void UpdateMember(TInt aMember,const TRect& aRect,TBool aFullUpdate);		//redraw of part of a sprite
sl@0
   127
	void Activate(TBool aActive);		// Turn sprite on or off
sl@0
   128
	void SizeChangedL();
sl@0
   129
	void SetPosition(const TPoint &aPos);			//Change the positon of the sprite
sl@0
   130
	TBool SpriteCanBeSeen() const;
sl@0
   131
// Functions from MAnimGeneralFunctionsEventExtension
sl@0
   132
	void PostKeyEvent(const TKeyEvent& aRawEvent,TInt aRepeats) const; //Repeated key events 
sl@0
   133
public:
sl@0
   134
	inline CWsAnim * Next();
sl@0
   135
private:
sl@0
   136
	inline CWindowAnim* WindowAnim() {return STATIC_CAST(CWindowAnim*,iAnim);}
sl@0
   137
private:
sl@0
   138
	static CWsAnimGc *WsAnimGc;
sl@0
   139
private:
sl@0
   140
	CWsClient *iClient;
sl@0
   141
	TTimeIntervalMicroSeconds iInterval;
sl@0
   142
	TAnimSync iAnimSync;
sl@0
   143
	CWsAnim *iNextWin;	// Linked list of animated objects attached to a window
sl@0
   144
	CAnim *iAnim;
sl@0
   145
	CWsAnimDll *iAnimDll;
sl@0
   146
	CWsClientWindow *iWindow;
sl@0
   147
	TRect iRect;
sl@0
   148
	CWsSprite *iSprite;
sl@0
   149
	const RMessagePtr2* iMessage;
sl@0
   150
	TWindowInfo::TRegionPair* iRedrawRegionPair;
sl@0
   151
	friend class CWsAnimDll;
sl@0
   152
	friend class DllAnimator;
sl@0
   153
	mutable TBool iAnimAddedInHandler;
sl@0
   154
	TTime iStartTime;
sl@0
   155
	TInt iLastFrame;
sl@0
   156
	TBool iFlashOn;
sl@0
   157
	};
sl@0
   158
sl@0
   159
class CAnimFbsFont;
sl@0
   160
sl@0
   161
class CWsAnimGc : public CAnimGc
sl@0
   162
	{
sl@0
   163
	friend class CWsAnim;
sl@0
   164
public:
sl@0
   165
	CWsAnimGc();
sl@0
   166
//
sl@0
   167
	void Activate(CWsClientWindow *aWindow, CWsAnim *aWsAnim, const TRegion *aRegion, CFbsBitGc * aGc);
sl@0
   168
	void Deactivate();
sl@0
   169
	TBool IsActive() const;
sl@0
   170
	void UserActivate(CWsClientWindow *aWindow, CWsAnim *aWsAnim);
sl@0
   171
	void UserDeactivate();
sl@0
   172
	void AnimDeleted(CWsAnim *aWsAnim);
sl@0
   173
// From CGraphicsContext
sl@0
   174
	virtual CGraphicsDevice* Device() const;
sl@0
   175
	virtual void SetDrawMode(TDrawMode aDrawingMode);
sl@0
   176
	virtual void SetClippingRect(const TRect& aRect);
sl@0
   177
	virtual void CancelClippingRect();
sl@0
   178
	virtual void CancelClippingRegion();
sl@0
   179
	virtual void UseFont(const CFont *aFont);
sl@0
   180
	virtual void DiscardFont();
sl@0
   181
	virtual void SetUnderlineStyle(TFontUnderline aUnderlineStyle);
sl@0
   182
	virtual void SetStrikethroughStyle(TFontStrikethrough aStrikethroughStyle);
sl@0
   183
	virtual void SetWordJustification(TInt aExcessWidth,TInt aNumGaps);
sl@0
   184
	virtual void SetCharJustification(TInt aExcessWidth,TInt aNumChars);
sl@0
   185
	virtual void SetPenColor(const TRgb &aColor);
sl@0
   186
	virtual void SetPenStyle(TPenStyle aPenStyle);
sl@0
   187
	virtual void SetPenSize(const TSize& aSize);
sl@0
   188
	virtual void SetBrushColor(const TRgb &aColor);
sl@0
   189
	virtual void SetBrushStyle(TBrushStyle aBrushStyle);
sl@0
   190
	virtual void SetBrushOrigin(const TPoint &aOrigin);
sl@0
   191
	virtual void UseBrushPattern(const CFbsBitmap *aBitmap);
sl@0
   192
	virtual void DiscardBrushPattern();
sl@0
   193
	virtual void DrawArc(const TRect &aRect,const TPoint &aStart,const TPoint &aEnd);
sl@0
   194
	virtual void DrawLine(const TPoint &aPoint1,const TPoint &aPoint2);
sl@0
   195
	virtual void DrawLineTo(const TPoint &aPoint);
sl@0
   196
	virtual void DrawLineBy(const TPoint &aPoint);
sl@0
   197
	virtual void DrawPolyLine(const CArrayFix<TPoint> *aPointList);
sl@0
   198
	virtual void DrawPolyLine(const TPoint* aPointList,TInt aNumPoints);
sl@0
   199
	virtual void DrawPie(const TRect &aRect,const TPoint &aStart,const TPoint &aEnd);
sl@0
   200
	virtual void DrawEllipse(const TRect &aRect);
sl@0
   201
	virtual void DrawRect(const TRect &aRect);
sl@0
   202
	virtual void DrawRoundRect(const TRect &aRect,const TSize &aCornerSize);
sl@0
   203
	virtual void Clear(const TRect &aRect);
sl@0
   204
	virtual void Clear();
sl@0
   205
	virtual TInt DrawPolygon(const CArrayFix<TPoint> *aPointList,TFillRule aFillRule);
sl@0
   206
	virtual TInt DrawPolygon(const TPoint* aPointList,TInt aNumPoints,TFillRule aFillRule=EAlternate);
sl@0
   207
	virtual void DrawBitmap(const TPoint &aTopLeft, const CFbsBitmap *aSource);
sl@0
   208
	virtual void DrawBitmap(const TRect &aDestRect, const CFbsBitmap *aSource);
sl@0
   209
	virtual void DrawBitmap(const TRect &aDestRect, const CFbsBitmap *aSource, const TRect &aSourceRect);
sl@0
   210
	virtual void DrawBitmapMasked(const TRect &aDestRect, const CFbsBitmap *aBitmap, const TRect &aSrcRect, const CFbsBitmap* aMaskBitmap, TBool aInvertMask);
sl@0
   211
	virtual void DrawText(const TDesC &aString,const TPoint &aPosition);
sl@0
   212
	virtual void DrawText(const TDesC &aString,const TRect &aBox,TInt aBaselineOffset,TTextAlign aHoriz=ELeft,TInt aLeftMrg=0);
sl@0
   213
	virtual void MoveTo(const TPoint &aPoint);
sl@0
   214
	virtual void MoveBy(const TPoint &aPoint);
sl@0
   215
	virtual void Plot(const TPoint &aPoint);
sl@0
   216
	virtual void SetOrigin(const TPoint &aPoint);
sl@0
   217
	virtual void BitBlt(const TPoint &,const CFbsBitmap *aBitmap);
sl@0
   218
	virtual void BitBlt(const TPoint &,const CFbsBitmap *aBitmap,const TRect &);
sl@0
   219
	virtual void BitBltMasked(const TPoint& aPoint,const CFbsBitmap* aBitmap,const TRect& aSourceRect,const CFbsBitmap* aMaskBitmap,TBool aInvertMask);
sl@0
   220
	virtual void CopyRect(const TPoint& aOffset,const TRect& aRect);
sl@0
   221
	virtual void Reset();
sl@0
   222
// Extra command defined in CBitmapContext
sl@0
   223
	virtual void SetFaded(TBool aFaded);
sl@0
   224
	virtual void SetFadingParameters(TUint8 aBlackMap,TUint8 aWhiteMap);
sl@0
   225
sl@0
   226
	virtual TInt SetClippingRegion(const TRegion &aRegion);	
sl@0
   227
	virtual TInt AlphaBlendBitmaps(const TPoint& aDestPt, const CFbsBitmap* aSrcBmp, const TRect& aSrcRect, const CFbsBitmap* aAlphaBmp,	const TPoint& aAlphaPt);	
sl@0
   228
	virtual void MapColors(const TRect &aRect,const TRgb *aColors,TInt aNumPairs,TBool aMapForwards);
sl@0
   229
	virtual void DrawTextVertical(const TDesC& aText,const TPoint& aPos,TBool aUp);
sl@0
   230
	virtual void DrawTextVertical(const TDesC& aText,const TRect& aBox,TInt aBaselineOffset,TBool aUp,TTextAlign aVert=ELeft,TInt aMargin=0);
sl@0
   231
	
sl@0
   232
private:
sl@0
   233
	void SetDrawingRegions(const TRegion *aRegion);
sl@0
   234
	void CloseCurrentFont();
sl@0
   235
	virtual void DrawBitmapMasked(const TRect& /*aDestRect*/,const CWsBitmap* /*aBitmap*/,const TRect& /*aSrcRect*/,const CWsBitmap* /*aMaskBitmap*/, TBool /*aInvertMask*/);
sl@0
   236
	TInt AlphaBlendBitmaps(const TPoint& aDestPt, const CWsBitmap* aSrcBmp,	const TRect& aSrcRect, const CWsBitmap* aAlphaBmp,	const TPoint& aAlphaPt);
sl@0
   237
private:
sl@0
   238
	CFbsBitGc* iGc;
sl@0
   239
	TBool iUserActive;
sl@0
   240
	const TRegion *iBaseRegion;	// Pointer to base clipping region
sl@0
   241
	TBool iUseDrawingRegion; // If ETrue use iDrawingRegion instead of iBaseRegion
sl@0
   242
	RWsRegion iDrawingRegion;	// Intersection of iBaseRegion and extra clipping
sl@0
   243
	CWsClientWindow *iWin;
sl@0
   244
	RWsRegion iAnimateRegion;
sl@0
   245
	CWsAnim *iOwningWsAnim;
sl@0
   246
	TRect iClippingRect;
sl@0
   247
	CAnimFbsFont *iFont;
sl@0
   248
	};
sl@0
   249
sl@0
   250
//
sl@0
   251
// inlines			//
sl@0
   252
//
sl@0
   253
sl@0
   254
inline CAnim *CWsAnim::Anim() const
sl@0
   255
	{return(iAnim);}
sl@0
   256
inline TInt CWsAnimDll::AnimObjectHandle(CWsAnim *aAnimObject) const
sl@0
   257
	{return(iInstanceIndex->At(aAnimObject));}
sl@0
   258
inline CWsAnim* CWsAnimDll::AnimObjectL(TInt aAnimHandle) const
sl@0
   259
	{return STATIC_CAST(CWsAnim*,iInstanceIndex->AtL(aAnimHandle));}
sl@0
   260
inline CWsAnim* CWsAnim::Next()
sl@0
   261
	{return iNextWin;}
sl@0
   262
#endif