|
1 // Copyright (c) 1997-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 // |
|
15 |
|
16 #if !defined(__TFEP2BE_H__) |
|
17 #define __TFEP2BE_H__ |
|
18 |
|
19 #if !defined(__E32STD_H__) |
|
20 #include <e32std.h> |
|
21 #endif |
|
22 |
|
23 #if !defined(__E32BASE_H__) |
|
24 #include <e32base.h> |
|
25 #endif |
|
26 |
|
27 #if !defined(__W32ADLL_H__) |
|
28 #include <w32adll.h> |
|
29 #endif |
|
30 |
|
31 #if !defined(__TFEP2COM_H__) |
|
32 #include "tfep2com.h" |
|
33 #endif |
|
34 |
|
35 class TRawEvent; |
|
36 class CFbsBitmapDevice; |
|
37 class CFbsBitGc; |
|
38 |
|
39 class CTstHandWritingRecognizer : public CSpriteAnim |
|
40 { |
|
41 public: |
|
42 CTstHandWritingRecognizer(); |
|
43 ~CTstHandWritingRecognizer(); |
|
44 void HandleTimeOut(); |
|
45 private: |
|
46 typedef CArrayFix<TPoint> CPolyLine; |
|
47 enum |
|
48 { |
|
49 EPenWidthForMainBitmap=4, |
|
50 EPenWidthForMaskBitmap=6 |
|
51 }; |
|
52 enum |
|
53 { |
|
54 EFlagReferenceCountIncremented =0x00000001, |
|
55 EFlagPointerIsDown =0x00000002, |
|
56 EFlagUpperCase =0x00000004 |
|
57 }; |
|
58 struct SBitmapHandlesWithReferenceCount |
|
59 { |
|
60 STstBitmapHandles iBitmapHandles; |
|
61 TInt iReferenceCount; |
|
62 }; |
|
63 class RFlatArrayOfCharacters |
|
64 { |
|
65 public: |
|
66 RFlatArrayOfCharacters(TInt aGranularity); |
|
67 void ConstructL(); |
|
68 void Close(); |
|
69 void AppendL(TUint aCharacter); |
|
70 TInt Count() const; |
|
71 TPtrC8 DescriptorFromStart(TInt aNumberOfCharacters) const; |
|
72 void RemoveFromStart(TInt aNumberOfCharacters); |
|
73 void Reset(); |
|
74 private: |
|
75 const TInt iGranularity; |
|
76 HBufC8* iDescriptor; |
|
77 }; |
|
78 class CTimeOutTimer : public CTimer |
|
79 { |
|
80 public: |
|
81 static CTimeOutTimer* NewL(CTstHandWritingRecognizer& aHandWritingRecognizer); |
|
82 virtual ~CTimeOutTimer(); |
|
83 private: |
|
84 CTimeOutTimer(CTstHandWritingRecognizer& aHandWritingRecognizer); |
|
85 virtual void RunL(); |
|
86 private: |
|
87 CTstHandWritingRecognizer& iHandWritingRecognizer; |
|
88 }; |
|
89 private: |
|
90 void ConstructLP(TAny* aParameters); |
|
91 TInt CommandReplyLP(TInt aOpcode, TAny* aParameters); |
|
92 TBool OfferRawEventLP(const TRawEvent& aRawEvent); |
|
93 void DoRecognitionL(); |
|
94 void MovePendingCharactersToClientBufferL(); |
|
95 void CompleteRequestForCharacters(TInt aErrorCode); |
|
96 void ClearBitmap(CFbsBitmapDevice& aBitmap); |
|
97 void DrawLine(CFbsBitmapDevice& aBitmap, TRect& aRectangleDrawnTo, TInt aPenSize, const TPoint& aPoint1, const TPoint& aPoint2); |
|
98 void Plot(CFbsBitmapDevice& aBitmap, TRect& aRectangleDrawnTo, TInt aPenSize, const TPoint& aPoint); |
|
99 // from CSpriteAnim |
|
100 virtual void ConstructL(TAny* aParameters); |
|
101 // from CAnim |
|
102 virtual TInt CommandReplyL(TInt aOpcode, TAny* aParameters); |
|
103 virtual void Command(TInt aOpcode, TAny* aParameters); |
|
104 virtual void Animate(TDateTime* aDateTime); |
|
105 // from MEventHandler (indirectly, via CAnim) |
|
106 virtual TBool OfferRawEvent(const TRawEvent& aRawEvent); |
|
107 private: |
|
108 TUint iFlags; |
|
109 RPointerArray<CPolyLine> iArrayOfPolyLines; |
|
110 RFlatArrayOfCharacters iArrayOfCharactersPending; |
|
111 CTimeOutTimer* iTimeOutTimer; |
|
112 RMessagePtr2 iMessage_RequestForNotificationOfStartOfTransaction; |
|
113 RMessagePtr2 iMessage_RequestForCharacters; |
|
114 TInt iMaximumLengthOfClientSideCharacterBuffer; // effectively the MaxLength of the descriptor in the client-side address-space |
|
115 CFbsBitmapDevice* iMainBitmap; |
|
116 CFbsBitmapDevice* iMaskBitmap; |
|
117 CFbsBitGc* iGraphicsContext; |
|
118 }; |
|
119 |
|
120 class CTstDll : public CAnimDll |
|
121 { |
|
122 public: |
|
123 CAnim* CreateInstanceL(TInt aType); |
|
124 }; |
|
125 |
|
126 #endif |
|
127 |