sl@0: // Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // Demonstration handwriting class sl@0: // sl@0: // sl@0: sl@0: #if !defined(__HANDANIM_H__) sl@0: #define __HANDANIM_H__ sl@0: sl@0: #if !defined(__E32STD_H__) sl@0: #include sl@0: #endif sl@0: #if !defined(__E32BASE_H__) sl@0: #include sl@0: #endif sl@0: #if !defined(__GDI_H__) sl@0: #include sl@0: #endif sl@0: #if !defined(__W32ADLL_H__) sl@0: #include sl@0: #endif sl@0: #if !defined(__HANDCMD_H__) sl@0: #include "HANDCMD.H" sl@0: #endif sl@0: sl@0: sl@0: class CPointStore : public CBase sl@0: { sl@0: public: sl@0: CPointStore(); sl@0: void ConstructL(); sl@0: void AddPoint(TPoint aPoint); sl@0: TInt GetChar(); sl@0: void ClearPoints(); sl@0: private: sl@0: CArrayFixFlat *iPoints; sl@0: TInt iNumPoints; sl@0: }; sl@0: sl@0: class CHandWritingAnimDll : public CAnimDll sl@0: { sl@0: public: sl@0: CAnim *CreateInstanceL(TInt aType); sl@0: private: sl@0: }; sl@0: sl@0: class CHandWritingAnim : public CSpriteAnim sl@0: { sl@0: public: sl@0: enum TState sl@0: { sl@0: EHwStateDeactive, sl@0: EHwStateInactive, //Waiting for first point sl@0: EHwStateWaitingMove, //Waiting to see if a period elapses before the first move sl@0: EHwStateDrawing, //Pen down and drawing sl@0: EHwStateWaitingStroke, //Waiting for new stroke sl@0: }; sl@0: public: sl@0: ~CHandWritingAnim(); sl@0: //pure virtual functions from MEventHandler sl@0: TBool OfferRawEvent(const TRawEvent &aRawEvent); sl@0: //pure virtual functions from CAnim sl@0: void ConstructL(TAny *aArgs); sl@0: void Animate(TDateTime *aDateTime); sl@0: void Redraw(); sl@0: void Command(TInt aOpcode, TAny *aArgs); sl@0: TInt CommandReplyL(TInt aOpcode, TAny *aArgs); sl@0: void FocusChanged(TBool aState); sl@0: private: sl@0: void Activate(); sl@0: void Deactivate(); sl@0: void SpriteChangeL(TBool aUsingSeparateMask); sl@0: void SetDrawData(THandwritingDrawData *aDrawData); sl@0: TBool HandlePointerDown(TPoint aPoint); sl@0: TBool HandlePointerMove(TPoint aPoint); sl@0: TBool HandlePointerUp(TPoint aPoint); sl@0: void DrawPoint(); sl@0: void DrawLine(TPoint aEndPoint); sl@0: void UpdateSprite(); sl@0: void StartTimer(); sl@0: void SendEatenDownEvent(); sl@0: void CharacterFinished(); sl@0: void ClearSprite(); sl@0: private: sl@0: TInt iState; sl@0: CFbsBitmapDevice *iBitmapDevice; sl@0: CFbsBitmapDevice *iMaskBitmapDevice; sl@0: CFbsBitGc *iSpriteGc; sl@0: TBool iIsMask; sl@0: THandwritingDrawData iDrawData; sl@0: TPoint iCurrentDrawPoint; sl@0: TTime iDownTime; //Will need to use this when taken base changes sl@0: CPointStore *iPointStore; sl@0: TInt iLastGeneratedCharacter; sl@0: }; sl@0: sl@0: #endif