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