2 * Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
14 * Description: Pictograph drawer interface.
20 #ifndef AKN_PICTOGRAPH_DRAWER_INTERFACE_H
21 #define AKN_PICTOGRAPH_DRAWER_INTERFACE_H
29 enum TAknPictographHeight
38 enum TAknPictographDrawingMode
40 EDrawingModeNormal = 0,
44 // FORWARD DECLARATIONS
51 class MAknPictographAnimatorCallBack
55 * This function is called when a redraw is needed for drawing
56 * new frames of animated pictographs. It should
58 * 1) Draw or clear the background of pictographs
59 * 2) If the pictographs are amongst text, draw the text
60 * 3) Draw the pictographs using MAknPictographDrawer interface
62 * In many cases, it is sufficient to implement this simply by
63 * calling CCoeControl::DrawNow for the appropriate control.
65 virtual void DrawPictographArea() = 0;
69 * Pictograph drawer interface
74 NONSHARABLE_CLASS(MAknPictographDrawer)
76 public: // Constructors and destructor
81 inline virtual ~MAknPictographDrawer() {};
83 public: // New functions
86 * Returns a heap descriptor filled with all supported
88 * They are sorted in ascending pictograph code order.
89 * Ownership of the returned object is transferred to the caller.
92 * @return Heap descriptor filled with all supported
95 virtual HBufC* SupportedPictographCodesL() const = 0;
98 * Tells whether the character is in the pictograph code range.
101 * @param aCode Character code in Unicode.
102 * @return ETrue if in pictograph code range, EFalse if not.
104 virtual TBool IsPictograph( TText aCode ) const = 0;
107 * Tells whether the text contains any pictographs.
111 * @return ETrue if the text contains any pictographs, EFalse if not.
113 virtual TBool ContainsPictographs( const TDesC& aText ) const = 0;
116 * Draws pictograph bitmap in the given position.
117 * This method sets aGc to use CGraphicsContext::ENullBrush.
120 * @param aGc Graphics context.
121 * @param aTopLeft Top left coordinates of the rendering position .
122 * @param aCode Pictograph code in Unicode.
123 * @param aHeight Pictograph height.
125 virtual void DrawPictograph(
127 const TPoint& aTopLeft,
129 TAknPictographHeight aHeight ) const = 0;
132 * Draws pictograph bitmap centered in the given rect.
133 * This method sets aGc to use CGraphicsContext::ENullBrush.
136 * @param aGc Graphics context.
137 * @param aRect Rectangle, where the pictograph is centered in.
138 * @param aCode Pictograph code in Unicode.
139 * @param aHeight Pictograph height.
141 virtual void DrawPictograph(
145 TAknPictographHeight aHeight ) const = 0;
148 * Draws pictograph bitmap centered in the given rect,
149 * clipped with clipping rect.
150 * This method sets aGc to use CGraphicsContext::ENullBrush.
153 * @param aGc Graphics context.
154 * @param aRect Rectangle, where the pictograph is centered in.
155 * @param aClipRect Clipping rectangle.
156 * @param aCode Pictograph code in Unicode.
157 * @param aHeight Pictograph height.
159 virtual void DrawPictograph(
162 const TRect& aClipRect,
164 TAknPictographHeight aHeight ) const = 0;
167 * Draws text using CGraphicsContext::DrawText and then
168 * draws pictographs on top of that.
170 * Suitable pictograph height is chosen based on aFont.
172 * The graphics context aGc must be set to use font aFont
173 * before calling this method.
175 * This method sets aGc to use CGraphicsContext::ENullBrush.
178 * @param aGc Graphics context.
179 * @param aFont Used font.
181 * @param aPosition Text baseline coordinates of the starting position.
183 virtual void DrawText(
187 const TPoint& aPosition ) const = 0;
190 * Draws text using CGraphicsContext::DrawText and then
191 * draws pictographs on top of that.
193 * Suitable pictograph height is chosen based on aFont.
195 * The graphics context aGc must be set to use font aFont
196 * before calling this method.
198 * This method sets aGc to use CGraphicsContext::ENullBrush.
201 * @param aGc Graphics context.
202 * @param aFont Used font.
204 * @param aBox Rectangle, where the text is rendered.
205 * @param aBaselineOffset Offset from the top of the rectangle to
206 * the baseline to the text.
207 * @param aAlignment Text alignment.
208 * @param aLeftMargin The left margin for left-aligned text, or the right
209 * margin for right-aligned text
211 virtual void DrawText(
216 TInt aBaselineOffset,
217 CGraphicsContext::TTextAlign aAlignment =
218 CGraphicsContext::ELeft,
219 TInt aLeftMargin = 0 ) const = 0;
222 * Draws pictographs that are encountered in the text.
223 * Suitable pictograph height is chosen based on aFont.
224 * This method sets aGc to use CGraphicsContext::ENullBrush.
227 * @param aGc Graphics context.
228 * @param aFont Used font.
230 * @param aPosition Text baseline coordinates of the starting position.
232 virtual void DrawPictographsInText(
236 const TPoint& aPosition ) const = 0;
239 * Draws pictographs that are encountered in the text.
240 * This method sets aGc to use CGraphicsContext::ENullBrush.
243 * @param aGc Graphics context.
244 * @param aFont Used font.
246 * @param aBox Rectangle, where the text is rendered.
247 * @param aBaselineOffset Offset from the top of the rectangle to
248 * the baseline to the text.
249 * @param aAlignment Text alignment.
250 * @param aLeftMargin The left margin for left-aligned text, or the right
251 * margin for right-aligned text
253 virtual void DrawPictographsInText(
258 TInt aBaselineOffset,
259 CGraphicsContext::TTextAlign aAlignment =
260 CGraphicsContext::ELeft,
261 TInt aLeftMargin = 0 ) const = 0;
264 * Tells whether the given pictograph is animated or not.
267 * @param aCode Pictograph code in Unicode.
269 virtual TBool IsAnimated( TText aCode, TAknPictographHeight aHeight ) const = 0;
272 * Tries to find a matching pictograph height for a given font.
275 * @param aFont Used font.
276 * @param aHeight Pictograph height.
277 * @return KErrNone if a supported pictograph height is found that matches
278 * aFont otherwise returns KErrNotSupported
280 virtual TInt SelectPictographHeightForFont(
282 TAknPictographHeight& aHeight
286 * Sets the pictograph drawing mode for DrawPictograph calls. Other functions e.g.
287 * DrawText, etc are unaffected by this function.
288 * The drawing mode is set to EDrawingModeNormal by default.
289 * Note: When drawing mode EDrawingModeWhite is set only a single DrawPictograph call
290 * is supported per component->Draw() call.
293 * @param aDrawingMode the new pictograph drawing mode to be used.
294 * @return the value of the previous pictograph drawing mode.
296 virtual TAknPictographDrawingMode SetPictographDrawingMode(
297 TAknPictographDrawingMode aDrawingMode) = 0;
300 #endif // AKN_PICTOGRAPH_DRAWER_INTERFACE_H