|
1 /* |
|
2 * Copyright (c) 2002 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: Pictograph drawer. It handles drawing pictographs. |
|
15 * |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 #ifndef AKN_PICTOGRAPH_DRAWER_IMPL_H |
|
22 #define AKN_PICTOGRAPH_DRAWER_IMPL_H |
|
23 |
|
24 // INCLUDES |
|
25 #include "AknPictographDrawerInterface.h" |
|
26 #include <e32base.h> |
|
27 |
|
28 // CONSTANTS |
|
29 |
|
30 // FORWARD DECLARATIONS |
|
31 |
|
32 class CFont; |
|
33 struct TAknPictographData; |
|
34 class CAknPictographAnimator; |
|
35 class CCoeControl; |
|
36 |
|
37 // CLASS DECLARATION |
|
38 |
|
39 /** |
|
40 * Avkon's Pictograph drawer |
|
41 */ |
|
42 NONSHARABLE_CLASS(CAknPictographDrawer) : |
|
43 public CBase, |
|
44 public MAknPictographDrawer |
|
45 { |
|
46 public: // Constructors and destructor |
|
47 |
|
48 /** |
|
49 * Two-phased constructor. |
|
50 */ |
|
51 static CAknPictographDrawer* NewL( |
|
52 MAknPictographAnimatorCallBack& aCallBack ); |
|
53 |
|
54 /** |
|
55 * Destructor. |
|
56 */ |
|
57 ~CAknPictographDrawer(); |
|
58 |
|
59 public: // New functions |
|
60 |
|
61 void AnimationTick(); |
|
62 void HandleGainingForeground(); |
|
63 void HandleLosingForeground(); |
|
64 |
|
65 inline TBool IsAnimating() const; |
|
66 |
|
67 public: // Functions from MAknPictographDrawer (commented there) |
|
68 |
|
69 HBufC* SupportedPictographCodesL() const; |
|
70 TBool IsPictograph( TText aCode ) const; |
|
71 TBool ContainsPictographs( const TDesC& aText ) const; |
|
72 |
|
73 void DrawPictograph( |
|
74 CBitmapContext& aGc, |
|
75 const TPoint& aTopLeft, |
|
76 TText aCode, |
|
77 TAknPictographHeight aHeight ) const; |
|
78 |
|
79 void DrawPictograph( |
|
80 CBitmapContext& aGc, |
|
81 const TRect& aRect, |
|
82 TText aCode, |
|
83 TAknPictographHeight aHeight ) const; |
|
84 |
|
85 void DrawPictograph( |
|
86 CBitmapContext& aGc, |
|
87 const TRect& aRect, |
|
88 const TRect& aClipRect, |
|
89 TText aCode, |
|
90 TAknPictographHeight aHeight ) const; |
|
91 |
|
92 void DrawText( |
|
93 CBitmapContext& aGc, |
|
94 const CFont& aFont, |
|
95 const TDesC& aText, |
|
96 const TPoint& aPosition ) const; |
|
97 |
|
98 void DrawText( |
|
99 CBitmapContext& aGc, |
|
100 const CFont& aFont, |
|
101 const TDesC& aText, |
|
102 const TRect& aBox, |
|
103 TInt aBaselineOffset, |
|
104 CGraphicsContext::TTextAlign aAlignment = CGraphicsContext::ELeft, |
|
105 TInt aLeftMargin = 0 ) const; |
|
106 |
|
107 void DrawPictographsInText( |
|
108 CBitmapContext& aGc, |
|
109 const CFont& aFont, |
|
110 const TDesC& aText, |
|
111 const TPoint& aPosition ) const; |
|
112 |
|
113 void DrawPictographsInText( |
|
114 CBitmapContext& aGc, |
|
115 const CFont& aFont, |
|
116 const TDesC& aText, |
|
117 const TRect& aBox, |
|
118 TInt aBaselineOffset, |
|
119 CGraphicsContext::TTextAlign aAlignment = CGraphicsContext::ELeft, |
|
120 TInt aLeftMargin = 0 ) const; |
|
121 |
|
122 TBool IsAnimated( TText aCode, TAknPictographHeight aHeight ) const; |
|
123 |
|
124 |
|
125 TInt SelectPictographHeightForFont( |
|
126 const CFont& aFont, |
|
127 TAknPictographHeight& aHeight |
|
128 ) const; |
|
129 |
|
130 TAknPictographDrawingMode SetPictographDrawingMode( |
|
131 TAknPictographDrawingMode aDrawingMode); |
|
132 |
|
133 private: // New functions |
|
134 |
|
135 void DoDrawPictograph( |
|
136 CBitmapContext& aGc, |
|
137 const TPoint& aTopLeft, |
|
138 const TAknPictographData& aData, |
|
139 TRect* aRect ) const; |
|
140 |
|
141 void DrawPictographs( |
|
142 CBitmapContext& aGc, |
|
143 const CFont& aFont, |
|
144 const TDesC& aText, |
|
145 const TPoint& aPosition, |
|
146 const TRect* aClipRect ) const; |
|
147 |
|
148 void StartAnimatorIfRequired() const; |
|
149 void StopAnimator() const; |
|
150 |
|
151 TInt FetchPictographData( |
|
152 TText aCode, |
|
153 TAknPictographData& aData ) const; |
|
154 |
|
155 private: |
|
156 |
|
157 /** |
|
158 * C++ default constructor. |
|
159 */ |
|
160 CAknPictographDrawer( MAknPictographAnimatorCallBack& aCallBack ); |
|
161 |
|
162 /** |
|
163 * 2nd phase constructor. |
|
164 */ |
|
165 void ConstructL(); |
|
166 |
|
167 private: // Data |
|
168 |
|
169 /** |
|
170 * Pictograph animator, not owned. |
|
171 */ |
|
172 CAknPictographAnimator* iAnimator; |
|
173 |
|
174 /** |
|
175 * CallBack to draw animation frames. |
|
176 */ |
|
177 MAknPictographAnimatorCallBack& iCallBack; |
|
178 |
|
179 /** |
|
180 * Currently used pictograph height. Modified during drawing routine. |
|
181 */ |
|
182 mutable TAknPictographHeight iCurrentHeight; |
|
183 |
|
184 /** |
|
185 * Flags. Modified during drawing routine. |
|
186 */ |
|
187 mutable TInt16 iFlags; |
|
188 |
|
189 /** |
|
190 * Currently used pictograph drawing mode. |
|
191 */ |
|
192 TAknPictographDrawingMode iDrawingMode; |
|
193 }; |
|
194 |
|
195 #include "AknPictographDrawer.inl" |
|
196 |
|
197 #endif // AKN_PICTOGRAPH_DRAWER_IMPL_H |
|
198 |
|
199 // End of File |