AknsDrawUtils Class Reference

class AknsDrawUtils

Static utility class to support Avkon Skins drawing operations. AknsDrawUtils provides utility methods to perform skin-aware drawing operations, such as background drawing.

This is a public static class with exported functions. The class is not intended for derivation outside the library.

AknSkins.lib

2.0

Public Member Functions
IMPORT_C TBoolBackground(MAknsSkinInstance *, MAknsControlContext *, CWindowGc &, const TRect &)
IMPORT_C TBoolBackground(MAknsSkinInstance *, MAknsControlContext *, const CCoeControl *, CWindowGc &, const TRect &)
IMPORT_C TBoolBackground(MAknsSkinInstance *, MAknsControlContext *, const CCoeControl *, CWindowGc &, const TRect &, const TInt)
IMPORT_C TBoolBackgroundBetweenRects(MAknsSkinInstance *, MAknsControlContext *, CWindowGc &, const TRect &, const TRect &)
IMPORT_C TBoolBackgroundBetweenRects(MAknsSkinInstance *, MAknsControlContext *, const CCoeControl *, CWindowGc &, const TRect &, const TRect &)
IMPORT_C TBoolBackgroundBetweenRects(MAknsSkinInstance *, MAknsControlContext *, const CCoeControl *, CWindowGc &, const TRect &, const TRect &, const TInt)
IMPORT_C MAknsControlContext *ControlContext(const MObjectProvider *)
IMPORT_C MAknsControlContext *ControlContextOfParent(const CCoeControl *)
IMPORT_C TBoolDrawBackground(MAknsSkinInstance *, MAknsControlContext *, const CCoeControl *, CBitmapContext &, const TPoint &, const TRect &, const TInt)
IMPORT_C voidDrawCachedImage(MAknsSkinInstance *, CWindowGc &, const TRect &, const TAknsItemID &)
IMPORT_C voidDrawCachedImage(MAknsSkinInstance *, CFbsBitGc &, const TRect &, const TAknsItemID &)
IMPORT_C TBoolDrawFrame(MAknsSkinInstance *, CWindowGc &, const TRect &, const TRect &, const TAknsItemID &, const TAknsItemID &)
IMPORT_C TBoolDrawFrame(MAknsSkinInstance *, CFbsBitGc &, const TRect &, const TRect &, const TAknsItemID &, const TAknsItemID &, const TInt)
IMPORT_C TBoolDrawFrame(MAknsSkinInstance *, CFbsBitGc &, const TRect &, const TRect &, const TAknsItemID &, const TAknsItemID &)
IMPORT_C TBoolDrawFramePart(MAknsSkinInstance *, CWindowGc &, const TRect &, const TAknsItemID &, const TAknsFrameElementIndex)
IMPORT_C TBoolHasBitmapBackground(MAknsSkinInstance *, MAknsControlContext *)
IMPORT_C TBoolIsListSeperatorLines(MAknsSkinInstance *)
IMPORT_C TBoolPrepareFrame(MAknsSkinInstance *, const TRect &, const TRect &, const TAknsItemID &, const TAknsItemID &)
IMPORT_C TSlidingModeSlidingMode(MAknsSkinInstance *)
Private Member Functions
AknsDrawUtils()
~AknsDrawUtils()

Constructor & Destructor Documentation

AknsDrawUtils()

AknsDrawUtils()[private]

~AknsDrawUtils()

~AknsDrawUtils()[private]

Member Functions Documentation

Background(MAknsSkinInstance *, MAknsControlContext *, CWindowGc &, const TRect &)

IMPORT_C TBoolBackground(MAknsSkinInstance *aInstance,
MAknsControlContext *aContext,
CWindowGc &aGc,
const TRect &aRect
)[static]

Draws background with assumed origin. Draws bacground to the specified rectangle. Origin is assumed to be (0,0). This overload can not be used with parent absolute layouts.

See DrawBackground for details on chained layouts.

2.0

ETrue if background was drawn with a bitmap, EFalse otherwise.

Parameters

MAknsSkinInstance * aInstancePointer to skin instance as obtained from AknsUtils::SkinInstance(). If NULL rectangle is cleared without bitmap.
MAknsControlContext * aContextControl context to obtain context specific information about background drawing. If NULL and skin instance was given, default parameters are used.
CWindowGc & aGcGraphics context to be used for drawing.
const TRect & aRectRectangle to be drawn.

Background(MAknsSkinInstance *, MAknsControlContext *, const CCoeControl *, CWindowGc &, const TRect &)

IMPORT_C TBoolBackground(MAknsSkinInstance *aInstance,
MAknsControlContext *aContext,
const CCoeControl *aControl,
CWindowGc &aGc,
const TRect &aRect
)[static]

Draws background with proper origin. Draws bacground to the specified rectangle. The origin is queried from the control position list (if given using AknsUtils::RegisterControlPosition). If not found, the origin is queried from the given control, which may result in a window server flush.

See DrawBackground for details on chained layouts.

2.0

ETrue if background was drawn with a bitmap, EFalse otherwise. Note that many scalable skins implicitly define background bitmaps for seemingly blank areas.

Parameters

MAknsSkinInstance * aInstancePointer to skin instance as obtained from AknsUtils::SkinInstance(). If NULL rectangle is cleared without bitmap.
MAknsControlContext * aContextControl context to obtain context specific information about background drawing. Must be specified, if aInstance is not NULL.
const CCoeControl * aControlControl that knows the current window. Must be specified if parent absolute layout can be used, otherwise NULL may be given.
CWindowGc & aGcGraphics context to be used for drawing.
const TRect & aRectRectangle to be drawn.

Background(MAknsSkinInstance *, MAknsControlContext *, const CCoeControl *, CWindowGc &, const TRect &, const TInt)

IMPORT_C TBoolBackground(MAknsSkinInstance *aInstance,
MAknsControlContext *aContext,
const CCoeControl *aControl,
CWindowGc &aGc,
const TRect &aRect,
const TIntaDrawParam
)[static]

Draws background with proper origin and drawing parameters. Draws bacground to the specified rectangle. The origin is queried from the control position list (if given using AknsUtils::RegisterControlPosition). If not found, the origin is queried from the given control, which may result in a window server flush. Drawing parameters may be used to control drawing.

See DrawBackground for details on chained layouts.

2.0

ETrue if background was drawn with a bitmap, EFalse otherwise. Note that many scalable skins implicitly define background bitmaps for seemingly blank areas.

Parameters

MAknsSkinInstance * aInstancePointer to skin instance as obtained from AknsUtils::SkinInstance(). If NULL rectangle is cleared without bitmap.
MAknsControlContext * aContextControl context to obtain context specific information about background drawing. Must be specified, if aInstance is not NULL.
const CCoeControl * aControlControl that knows the current window. Must be specified if parent absolute layout can be used, otherwise NULL may be given.
CWindowGc & aGcGraphics context to be used for drawing.
const TRect & aRectRectangle to be drawn.
const TInt aDrawParamBitwise combination of drawing parameters. KAknsDrawParamDefault should be used if no special handling is required.

BackgroundBetweenRects(MAknsSkinInstance *, MAknsControlContext *, CWindowGc &, const TRect &, const TRect &)

IMPORT_C TBoolBackgroundBetweenRects(MAknsSkinInstance *aInstance,
MAknsControlContext *aContext,
CWindowGc &aGc,
const TRect &aOuterRect,
const TRect &aInnerRect
)[static]

Draws background between rects. Draws bacground between specified rectangles. Origin is assumed to be (0,0).

See DrawBackground for details on chained layouts.

2.0

ETrue if background was drawn with a bitmap, EFalse otherwise. Note that many scalable skins implicitly define background bitmaps for seemingly blank areas.

Parameters

MAknsSkinInstance * aInstancePointer to skin instance as obtained from AknsUtils::SkinInstance(). If NULL rectangle is cleared without bitmap.
MAknsControlContext * aContextControl context to obtain context specific information about background drawing. If NULL and skin instance was given, default parameters are used.
CWindowGc & aGcGraphics context to be used for drawing.
const TRect & aOuterRectOuter rectangle.
const TRect & aInnerRectInner rectangle.

BackgroundBetweenRects(MAknsSkinInstance *, MAknsControlContext *, const CCoeControl *, CWindowGc &, const TRect &, const TRect &)

IMPORT_C TBoolBackgroundBetweenRects(MAknsSkinInstance *aInstance,
MAknsControlContext *aContext,
const CCoeControl *aControl,
CWindowGc &aGc,
const TRect &aOuterRect,
const TRect &aInnerRect
)[static]

Draws background between rects. Draws bacground between specified rectangles.

See DrawBackground for details on chained layouts.

2.0

ETrue if background was drawn with a bitmap, EFalse otherwise. Note that many scalable skins implicitly define background bitmaps for seemingly blank areas.

Parameters

MAknsSkinInstance * aInstancePointer to skin instance as obtained from AknsUtils::SkinInstance(). If NULL rectangle is cleared without bitmap.
MAknsControlContext * aContextControl context to obtain context specific information about background drawing. Must be specified if aInstance is not NULL.
const CCoeControl * aControlControl that knows the current window. Must be specified if parent absolute layout can be used, otherwise NULL may be given.
CWindowGc & aGcGraphics context to be used for drawing.
const TRect & aOuterRectOuter rectangle.
const TRect & aInnerRectInner rectangle.

BackgroundBetweenRects(MAknsSkinInstance *, MAknsControlContext *, const CCoeControl *, CWindowGc &, const TRect &, const TRect &, const TInt)

IMPORT_C TBoolBackgroundBetweenRects(MAknsSkinInstance *aInstance,
MAknsControlContext *aContext,
const CCoeControl *aControl,
CWindowGc &aGc,
const TRect &aOuterRect,
const TRect &aInnerRect,
const TIntaDrawParam
)[static]

Draws background between rects. Draws bacground between specified rectangles with drawing parameters.

2.0

ETrue if background was drawn with a bitmap, EFalse otherwise. Note that many scalable skins implicitly define background bitmaps for seemingly blank areas.

Parameters

MAknsSkinInstance * aInstancePointer to skin instance as obtained from AknsUtils::SkinInstance(). If NULL rectangle is cleared without bitmap.
MAknsControlContext * aContextControl context to obtain context specific information about background drawing. Must be specified if aInstance is not NULL.
const CCoeControl * aControlControl that knows the current window. Must be specified if parent absolute layout can be used, otherwise NULL may be given.
CWindowGc & aGcGraphics context to be used for drawing.
const TRect & aOuterRectOuter rectangle.
const TRect & aInnerRectInner rectangle.
const TInt aDrawParamBitwise combination of drawing parameters. KAknsDrawParamDefault should be used if no special handling is required.

ControlContext(const MObjectProvider *)

IMPORT_C MAknsControlContext *ControlContext(const MObjectProvider *aMop)[static]

Returns pointer to the current control context. If aMop parameter is specified retrieves the nearest control context in control hierarchy. If none is found (or NULL parameter was given) returns NULL.

2.0

Pointer to the nearest control context or NULL if none was found.

Parameters

const MObjectProvider * aMopObject provider to be used to find the control context or NULL.

ControlContextOfParent(const CCoeControl *)

IMPORT_C MAknsControlContext *ControlContextOfParent(const CCoeControl *aControl)[static]

Returns pointer to the control context of the parent of the given control. The context possibly supplied by the control itself is ignored.

2.6

Pointer to the nearest control context of the parent control or NULL if none was found.

Parameters

const CCoeControl * aControlPointer to CCoeControl or NULL.

DrawBackground(MAknsSkinInstance *, MAknsControlContext *, const CCoeControl *, CBitmapContext &, const TPoint &, const TRect &, const TInt)

IMPORT_C TBoolDrawBackground(MAknsSkinInstance *aInstance,
MAknsControlContext *aContext,
const CCoeControl *aControl,
CBitmapContext &aGc,
const TPoint &aDstPos,
const TRect &aControlRect,
const TIntaDrawParam
)[static]

Draws background to the given graphics context. The origin is queried from the control position list (if given using AknsUtils::RegisterControlPosition). If not found, the origin is queried from the given control, which may result in a window server flush.

If background contains multiple layers, they are drawn in the sequence specified by the context. If multiple contexts are chained (using SetParentContext), they are drawn in reverse order, i.e. the context given as parameter to this method call is drawn last.

Drawing parameter KAknsDrawParamNoClearUnderImage is automatically assumed for all the chained contexts, except the deepest one.

2.0

ETrue if background was drawn with a bitmap, EFalse otherwise. Note that many scalable skins implicitly define background bitmaps for seemingly blank areas.

Parameters

MAknsSkinInstance * aInstancePointer to skin instance as obtained from AknsUtils::SkinInstance(). If NULL rectangle is cleared without bitmap.
MAknsControlContext * aContextControl context to obtain context specific information about background drawing. Must be specified, if aInstance is not NULL.
const CCoeControl * aControlControl that knows the current window. Must be specified if parent absolute layout can be used, otherwise NULL may be given.
CBitmapContext & aGcGraphics context to be used for drawing.
const TPoint & aDstPosDestination position (top-left corner of the area to be drawn) in graphics context coordinate system.
const TRect & aControlRectRectangle (in the control coordinate system) to be drawn.
const TInt aDrawParamBitwise combination of drawing parameters. KAknsDrawParamDefault should be used if no special handling is required.

DrawCachedImage(MAknsSkinInstance *, CWindowGc &, const TRect &, const TAknsItemID &)

IMPORT_C voidDrawCachedImage(MAknsSkinInstance *aInstance,
CWindowGc &aGc,
const TRect &aRect,
const TAknsItemID &aID
)[static]

Draws a cached image (with its attributes specified in the skin) to the given rectangle.

Parameters

MAknsSkinInstance * aInstancePointer to the skin instance. If NULL, the method returns immediately.
CWindowGc & aGcGraphics context to be used for drawing.
const TRect & aRectRectangle specifying the pane used for drawing. The image is laid out within the rectangle.
const TAknsItemID & aIDItem ID of the image to be drawn.

DrawCachedImage(MAknsSkinInstance *, CFbsBitGc &, const TRect &, const TAknsItemID &)

IMPORT_C voidDrawCachedImage(MAknsSkinInstance *aInstance,
CFbsBitGc &aGc,
const TRect &aRect,
const TAknsItemID &aID
)[static]

Draws a cached image (with its attributes specified in the skin) to the given rectangle in an off-screen graphics context.

2.8

Parameters

MAknsSkinInstance * aInstancePointer to the skin instance. If NULL, the method returns immediately.
CFbsBitGc & aGcBitmapped graphics context to be used for drawing.
const TRect & aRectRectangle specifying the pane used for drawing. The image is laid out within the rectangle.
const TAknsItemID & aIDItem ID of the image to be drawn.

DrawFrame(MAknsSkinInstance *, CWindowGc &, const TRect &, const TRect &, const TAknsItemID &, const TAknsItemID &)

IMPORT_C TBoolDrawFrame(MAknsSkinInstance *aInstance,
CWindowGc &aGc,
const TRect &aOuterRect,
const TRect &aInnerRect,
const TAknsItemID &aFrameID,
const TAknsItemID &aCenterID
)[static]

Draws a frame (with cached images) to the specified area.

EFalse, if the frame was not drawn at all. ETrue, if the frame was (at least partially) drawn.

Parameters

MAknsSkinInstance * aInstancePointer to the skin instance. If NULL, the method returns EFalse.
CWindowGc & aGcGraphics context to be used for drawing.
const TRect & aOuterRectOuter rectangle of the frame. Frame elements will be drawn within this rectangle.
const TRect & aInnerRectInner rectangle of the frame. Frame center will be drawn within this rectangle.
const TAknsItemID & aFrameIDItem ID of the entire frame.
const TAknsItemID & aCenterIDItem ID of the center part of the frame. If KAknsIIDNone, no center will be drawn. If KAknsIIDDefault, the default value from the frame itself will be used. Other values, the item to be used for the center part. If the frame is specified as 1 part graphics in the skin instead of 9 part graphics, this parameter has no effect.

DrawFrame(MAknsSkinInstance *, CFbsBitGc &, const TRect &, const TRect &, const TAknsItemID &, const TAknsItemID &, const TInt)

IMPORT_C TBoolDrawFrame(MAknsSkinInstance *aInstance,
CFbsBitGc &aGc,
const TRect &aOuterRect,
const TRect &aInnerRect,
const TAknsItemID &aFrameID,
const TAknsItemID &aCenterID,
const TIntaDrawParam
)[static]

Draws a frame (with cached images) to the specified area in an off-screen graphics context.

2.8

EFalse, if the frame was not drawn at all. ETrue, if the frame was (at least partially) drawn.

Parameters

MAknsSkinInstance * aInstancePointer to the skin instance. If NULL, the method returns EFalse.
CFbsBitGc & aGcBitmapped graphics context to be used for drawing.
const TRect & aOuterRectOuter rectangle of the frame. Frame elements will be drawn within this rectangle.
const TRect & aInnerRectInner rectangle of the frame. Frame center will be drawn within this rectangle.
const TAknsItemID & aFrameIDItem ID of the entire frame.
const TAknsItemID & aCenterIDItem ID of the center part of the frame. If KAknsIIDNone, no center will be drawn. If KAknsIIDDefault, the default value from the frame itself will be used. Other values, the item to be used for the center part. If unsure, specify KAknsIIDDefault. If the frame is specified as 1 part graphics in the skin instead of 9 part graphics, this parameter has no effect.
const TInt aDrawParamBitwise combination of drawing parameters. KAknsDrawParamDefault should be used if no special handling is required.

DrawFrame(MAknsSkinInstance *, CFbsBitGc &, const TRect &, const TRect &, const TAknsItemID &, const TAknsItemID &)

IMPORT_C TBoolDrawFrame(MAknsSkinInstance *aInstance,
CFbsBitGc &aGc,
const TRect &aOuterRect,
const TRect &aInnerRect,
const TAknsItemID &aFrameID,
const TAknsItemID &aCenterID
)[static]

Draws a frame (with cached images) to the specified area in an off-screen graphics context.

2.8

EFalse, if the frame was not drawn at all. ETrue, if the frame was (at least partially) drawn.

Parameters

MAknsSkinInstance * aInstancePointer to the skin instance. If NULL, the method returns EFalse.
CFbsBitGc & aGcBitmapped graphics context to be used for drawing.
const TRect & aOuterRectOuter rectangle of the frame. Frame elements will be drawn within this rectangle.
const TRect & aInnerRectInner rectangle of the frame. Frame center will be drawn within this rectangle.
const TAknsItemID & aFrameIDItem ID of the entire frame.
const TAknsItemID & aCenterIDItem ID of the center part of the frame. If KAknsIIDNone, no center will be drawn. If KAknsIIDDefault, the default value from the frame itself will be used. Other values, the item to be used for the center part. If unsure, specifi KAknsIIDDefault. If the frame is specified as 1 part graphics in the skin instead of 9 part graphics, this parameter has no effect.

DrawFramePart(MAknsSkinInstance *, CWindowGc &, const TRect &, const TAknsItemID &, const TAknsFrameElementIndex)

IMPORT_C TBoolDrawFramePart(MAknsSkinInstance *aInstance,
CWindowGc &aGc,
const TRect &aRect,
const TAknsItemID &aFrameID,
const TAknsFrameElementIndexaFrameElement
)[static]

Draws the specified part of the frame (with a cached image) to the specified rectangle.

Compatibility note:

Prior to Series 60 release 2.8, the entire outer rectangle could be given as the rectangle of a corner part. Due to scalable UI compatibility, this is no longer supported in release 2.8, and thus the exact corner rectangle is required. This funtion may not function correctly if the skin specifies the frame as 1 part graphics.

ETrue, if the element was drawn. EFalse otherwise.

Parameters

MAknsSkinInstance * aInstancePointer to the skin instance. If NULL, the method returns EFalse.
CWindowGc & aGcGraphics context to be used for drawing.
const TRect & aRectRectangle for drawing. This must be the rectangle of the specific part of the drawn that will be drawn, e.g. top-left corner rectangle if the top-left corner is being drawn.
const TAknsItemID & aFrameIDItem ID of the entire frame.
const TAknsFrameElementIndex aFrameElementElement (index) of the frame element to be drawn.

HasBitmapBackground(MAknsSkinInstance *, MAknsControlContext *)

IMPORT_C TBoolHasBitmapBackground(MAknsSkinInstance *aInstance,
MAknsControlContext *aContext
)[static]

Determines whether background drawing would be done with a bitmap (deprecated).

ETrue if background would be drawn with a bitmap, EFalse otherwise. If a scalable skin is currently active, the return value is undefined, and does not necessarily reflect the return value of the actual drawing operation.

This method is deprecated as of release 2.8. Use the return values of background drawing functions to determine whether the background was drawn with skinned content. The return value is always ETrue starting from rel 3.1

Parameters

MAknsSkinInstance * aInstancePointer to skin instance. If NULL, method returns EFalse.
MAknsControlContext * aContextControl context, or NULL if no context is used. Note that absence of control context affects the result.

IsListSeperatorLines(MAknsSkinInstance *)

IMPORT_C TBoolIsListSeperatorLines(MAknsSkinInstance *aInstance)[static]

Returns a boolean value indicating whether list separator lines should be drawn.

This method checks:
  • The value of KAknsIIDPropertyListSeparatorLines property.

  • The presence of (non-scalable) column bitmaps. If found, EFalse is returned.

  • The presence of generic list background (non-scalable). If found, EFalse is returned.

Note that the exact internal implementation of the checks is subject to change.

2.8

ETrue, if list separator lines should drawn. EFalse, if list separator lines should not be drawn and, consequently, list column and slice bitmaps (if any) from the skin content should be drawn.

Parameters

MAknsSkinInstance * aInstancePointer to the skin instance. If NULL, the method returns ETrue.

PrepareFrame(MAknsSkinInstance *, const TRect &, const TRect &, const TAknsItemID &, const TAknsItemID &)

IMPORT_C TBoolPrepareFrame(MAknsSkinInstance *aInstance,
const TRect &aOuterRect,
const TRect &aInnerRect,
const TAknsItemID &aFrameID,
const TAknsItemID &aCenterID
)[static]

Prepares the frame graphics for drawing. This function should be called when the frame sizes are known and in places where Flushing the Window server buffer will not cause flicker. For example, a good place to call PrepareFrame() would be controls SizeChanged function. Altough its not mandatory to call PrepareFrame() before DrawFrame(), it's highly recommended in order to avoid unnecessary flushes in the middle of the actual drawing routine.

Note that the rect parameters must be exactly the same for PrepareFrame and subsequent DrawFrame calls. Otherwise the DrawFrame functions will cause a flush, which leads to flicker.

2.8

EFalse, if were nothing to prepare. ETrue, if the frame was (at least partially) prepared.

Parameters

MAknsSkinInstance * aInstancePointer to the skin instance. If NULL, the method returns EFalse.
const TRect & aOuterRectOuter rectangle of the frame. Frame elements are scaled to this size.
const TRect & aInnerRectInner rectangle of the frame. Frame center is scaled to this size
const TAknsItemID & aFrameIDItem ID of the entire frame.
const TAknsItemID & aCenterIDItem ID of the center part of the frame. If KAknsIIDNone, no center part will be prepared. If KAknsIIDDefault, the default value from the frame itself will be used. Other values, the item to be used for the center part. If the frame is specified as 1 part graphics in the skin instead of 9 part graphics, this parameter has no effect.

SlidingMode(MAknsSkinInstance *)

IMPORT_C TSlidingModeSlidingMode(MAknsSkinInstance *aInstance)[static]

Returns an enum value indicating the way notes and queries appear to the screen (sliding animation)

3.1

Sliding mode from enumeration TSlidingMode

Parameters

MAknsSkinInstance * aInstancePointer to the skin instance. If NULL, the method returns ESlidingDisabled.