|
1 /* |
|
2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: smiley utility class |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef C_SMILEYDRAWER_H |
|
19 #define C_SMILEYDRAWER_H |
|
20 |
|
21 #include <e32base.h> |
|
22 #include <e32std.h> |
|
23 #include <coecntrl.h> |
|
24 |
|
25 class CSmileyModel; |
|
26 class CFbsBitmap; |
|
27 class CBitmapContext; |
|
28 class CFbsBitGc; |
|
29 class CSmileyImageData; |
|
30 class CSmileyIcon; |
|
31 class CEikEdwin; |
|
32 class CSmileyAsyncDraw; |
|
33 class CSmileyDrawer; |
|
34 |
|
35 class MSmileyAnimChecker |
|
36 { |
|
37 public: |
|
38 virtual TBool IsOnProgress() const = 0; |
|
39 virtual void ResetStatus() = 0; |
|
40 virtual void DoOnAnimStoppedL() = 0; |
|
41 }; |
|
42 |
|
43 NONSHARABLE_CLASS( TSmileyAnimCheckerWrapper ) |
|
44 { |
|
45 public: |
|
46 TSmileyAnimCheckerWrapper( MSmileyAnimChecker* aAnimChecker, TInt aMaxCheckTimes ); |
|
47 TBool IsContainingAnimChecker( const MSmileyAnimChecker* aAnimChecker ) const; |
|
48 void CheckAnimProgressL(); |
|
49 |
|
50 private: // data |
|
51 // not own |
|
52 MSmileyAnimChecker* iAnimChecker; |
|
53 TInt iCheckTimes; |
|
54 TInt iMaxCheckTimes; |
|
55 }; |
|
56 |
|
57 /** |
|
58 * class for reading and interpreting infomation stored in CenRep |
|
59 * |
|
60 * @lib ?library |
|
61 * @since S60 v5.0 |
|
62 */ |
|
63 |
|
64 NONSHARABLE_CLASS( CSmileyDrawer ): public CBase |
|
65 { |
|
66 public: |
|
67 static const TInt KDisplayTimes = 2; |
|
68 |
|
69 public: |
|
70 // constructor |
|
71 CSmileyDrawer( CSmileyModel& aModel, CEikEdwin& aEdwin ); |
|
72 ~CSmileyDrawer(); |
|
73 |
|
74 // new functions |
|
75 void DrawTextView(); |
|
76 |
|
77 void SetHighlightColor( TRgb aColor ); |
|
78 TRgb HighlightColor(){ return iHighlightColor; }; |
|
79 |
|
80 void DrawImageByIconL( CBitmapContext& aGc, CSmileyIcon* aNode ); |
|
81 void CreateImageByIconL( CSmileyIcon* aIcon ); |
|
82 void CreateImageL( CSmileyImageData* aImage ); |
|
83 |
|
84 void SetPlayTimes( TInt aPlayTimes ){ iPlayTimes = aPlayTimes; }; |
|
85 |
|
86 void SetVisibleRange( TInt aDocPos, TInt aLength ) |
|
87 { |
|
88 iVisibleStart = aDocPos; |
|
89 iVisibleLength = aLength; |
|
90 }; |
|
91 |
|
92 void StartAnimTimerL(); |
|
93 static TInt AnimTimerCallbackL( TAny* aPtr ); |
|
94 void CheckAnimStatusL(); |
|
95 void RegisterAnimChecker( MSmileyAnimChecker* aAnimChecker ); |
|
96 void RemoveAnimChecker( MSmileyAnimChecker* aAnimChecker ); |
|
97 CEikEdwin& Editor(){ return iEdwin; }; |
|
98 |
|
99 private: |
|
100 void DrawHighlightBmpL( CBitmapContext& aGc, CFbsBitmap* aBmp, |
|
101 CFbsBitmap* aMask, TPoint& aPt ); |
|
102 CSmileyImageData* FindImageDataByCode( TText aCode ); |
|
103 CSmileyImageData* CreateImageDataL( TText aCode ); |
|
104 |
|
105 private: // data |
|
106 CSmileyModel& iModel; |
|
107 CEikEdwin& iEdwin; |
|
108 |
|
109 RPointerArray<CSmileyImageData> iImageArray; |
|
110 |
|
111 TRgb iHighlightColor; |
|
112 TInt iPlayTimes; |
|
113 TInt iVisibleStart; |
|
114 TInt iVisibleLength; |
|
115 // own |
|
116 CSmileyAsyncDraw* iAsyncDraw; |
|
117 // own |
|
118 CPeriodic* iPeriodic; |
|
119 RArray<TSmileyAnimCheckerWrapper> iAnimArray; |
|
120 }; |
|
121 |
|
122 #endif C_SMILEYDRAWER_H |