windowing/windowserver/test/HANDANIM.H
changeset 0 5d03bc08d59c
equal deleted inserted replaced
-1:000000000000 0:5d03bc08d59c
       
     1 // Copyright (c) 1999-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 // Demonstration handwriting class
       
    15 // 
       
    16 //
       
    17 
       
    18 #if !defined(__HANDANIM_H__)
       
    19 #define __HANDANIM_H__
       
    20 
       
    21 #if !defined(__E32STD_H__)
       
    22 #include <e32std.h>
       
    23 #endif
       
    24 #if !defined(__E32BASE_H__)
       
    25 #include <e32base.h>
       
    26 #endif
       
    27 #if !defined(__GDI_H__)
       
    28 #include <gdi.h>
       
    29 #endif
       
    30 #if !defined(__W32ADLL_H__)
       
    31 #include <w32adll.h>
       
    32 #endif
       
    33 #if !defined(__HANDCMD_H__)
       
    34 #include "HANDCMD.H"
       
    35 #endif
       
    36 
       
    37 
       
    38 class CPointStore : public CBase
       
    39 	{
       
    40 public:
       
    41 	CPointStore();
       
    42 	void ConstructL();
       
    43 	void AddPoint(TPoint aPoint);
       
    44 	TInt GetChar();
       
    45 	void ClearPoints();
       
    46 private:
       
    47 	CArrayFixFlat<TPoint> *iPoints;
       
    48 	TInt iNumPoints;
       
    49 	};
       
    50 
       
    51 class CHandWritingAnimDll : public CAnimDll 
       
    52 	{
       
    53 public:
       
    54 	CAnim *CreateInstanceL(TInt aType);
       
    55 private:
       
    56 	};
       
    57 
       
    58 class CHandWritingAnim : public CSpriteAnim
       
    59 	{
       
    60 public:
       
    61 	enum TState
       
    62 		{
       
    63 		EHwStateDeactive,
       
    64 		EHwStateInactive,		//Waiting for first point
       
    65 		EHwStateWaitingMove,	//Waiting to see if a period elapses before the first move
       
    66 		EHwStateDrawing,		//Pen down and drawing
       
    67 		EHwStateWaitingStroke,	//Waiting for new stroke
       
    68 		};
       
    69 public:
       
    70 	~CHandWritingAnim();
       
    71 	//pure virtual functions from MEventHandler
       
    72 	TBool OfferRawEvent(const TRawEvent &aRawEvent);
       
    73 	//pure virtual functions from CAnim
       
    74 	void ConstructL(TAny *aArgs);
       
    75 	void Animate(TDateTime *aDateTime);
       
    76 	void Redraw();
       
    77 	void Command(TInt aOpcode, TAny *aArgs);
       
    78 	TInt CommandReplyL(TInt aOpcode, TAny *aArgs);
       
    79 	void FocusChanged(TBool aState);
       
    80 private:
       
    81 	void Activate();
       
    82 	void Deactivate();
       
    83 	void SpriteChangeL(TBool aUsingSeparateMask);
       
    84 	void SetDrawData(THandwritingDrawData *aDrawData);
       
    85 	TBool HandlePointerDown(TPoint aPoint);
       
    86 	TBool HandlePointerMove(TPoint aPoint);
       
    87 	TBool HandlePointerUp(TPoint aPoint);
       
    88 	void DrawPoint();
       
    89 	void DrawLine(TPoint aEndPoint);
       
    90 	void UpdateSprite();
       
    91 	void StartTimer();
       
    92 	void SendEatenDownEvent();
       
    93 	void CharacterFinished();
       
    94 	void ClearSprite();
       
    95 private:
       
    96 	TInt iState;
       
    97 	CFbsBitmapDevice *iBitmapDevice;
       
    98 	CFbsBitmapDevice *iMaskBitmapDevice;
       
    99 	CFbsBitGc *iSpriteGc;
       
   100 	TBool iIsMask;
       
   101 	THandwritingDrawData iDrawData;
       
   102 	TPoint iCurrentDrawPoint;
       
   103 	TTime iDownTime;			//Will need to use this when taken base changes
       
   104 	CPointStore *iPointStore;
       
   105 	TInt iLastGeneratedCharacter;
       
   106 	};
       
   107 
       
   108 #endif