2 * Copyright (c) 2002-2004 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: Defines a public static utility class AknsUtils.
23 #include <AknsSkinInstance.h>
25 #include <AknIconUtils.h>
27 // FORWARD DECLARATIONS
36 * Type of the application icon.
42 EAknsAppIconTypeList = 0,
43 EAknsAppIconTypeContext = 1,
44 EAknsAppIconType3D = 2
50 * Static utility class to support AVKON SKINS common operations.
51 * AknsUtils provides utility method to initialize application skin support,
52 * retrieve current skin instance or data context, retrieve skin data
53 * items and to perform other skin-related tasks.
55 * This is a public static class with exported functions.
56 * The class is not intended for derivation outside the library.
65 public: // New functions - Creators
68 * Initializes application skin support.
69 * Creates application skin instance. Method should be called once
70 * in the construction phase of application, before any other
71 * skin-related operations take place.
76 * The framework calls this method automatically for each
77 * application. Thus, a normal application does not need to
78 * call this method explicitly.
81 * - If allocation fails, function leaves with an error code.
83 IMPORT_C static void InitSkinSupportL();
86 * Creates data context suitable for a container.
87 * Constructs a new data context suitable for a container. Container
88 * should store the pointer and perform proper destruction when
89 * the lifetime of the container itself ends.
93 * @return Newly created data context. Ownership of the context object
94 * is transferred to the caller.
96 IMPORT_C static MAknsDataContext* CreateDataContextForContainerL();
99 * Constructs a new bitmap item definition object.
103 * @param aID Item ID of the item definition object to be created:
105 * @param aFile Filename of the MBM file.
107 * @param aIndex Index of the bitmap in the file.
109 * @return Newly constructed item definition object.
112 * If construction fails, the method leaves with an error code.
114 IMPORT_C static CAknsItemDef* CreateBitmapItemDefL(
115 const TAknsItemID& aID, const TDesC& aFilename,
119 * Constructs a new masked bitmap item definition object.
123 * @param aID Item ID of the item definition object to be created:
125 * @param aFile Filename of the MBM file.
127 * @param aIndex Index of the bitmap in the file.
129 * @param aIndex Index of the bitmap mask in the file.
131 * @return Newly constructed item definition object. Ownership of the
132 * object is transferred to the caller.
135 * If construction fails, the method leaves with an error code.
137 IMPORT_C static CAknsItemDef* CreateMaskedBitmapItemDefL(
138 const TAknsItemID& aID, const TDesC& aFilename,
139 const TInt aIndex, const TInt aMaskIndex );
141 public: // New functions - Skin access
144 * Returns pointer to current skin instance.
145 * Retrieves pointer to the current application skin instance singleton.
146 * If there is none, @c NULL value is returned.
150 * @return Pointer to current skin instance, or @c NULL if no skin
151 * support is available.
153 IMPORT_C static MAknsSkinInstance* SkinInstance();
156 * Returns pointer to current data context.
157 * If aMop parameter is specified, retrieves the nearest data context
158 * in control hierarchy. If none is found (or @c NULL parameter was
159 * given) returns root data context from skin instance. If there is
160 * no skin instance, @c NULL value is returned.
164 * @param aMop Object provider to be used to find the nearest data
165 * context. In most cases this should be a pointer to the calling
166 * @c CCoeControl. @c NULL value is also valid.
168 * @return Pointer to the nearest data context, or @c NULL if no
169 * skin support is available.
171 IMPORT_C static MAknsDataContext* DataContext( MObjectProvider* aMop );
173 public: // New functions - Item access w/ fallback support
176 * Constructs an independent masked bitmap with fallback support.
177 * Creates an independent (in terms of instance ownership) copy of a
178 * masked bitmap by the given item ID.
180 * If no matching item is found in the currently activate skin,
181 * attempts to construct the item using the given file.
187 * @param aInstance Pointer to the current skin instance.
188 * Usually retrieved using @c AknsUtils::SkinInstance.
190 * @param aID Item ID of the masked bitmap to be created.
192 * @param aBitmap If method succeeds, set to point to the
193 * newly constructed bitmap. Ownership of the bitmap is transferred
196 * @param aMask If method succeeds, set to point to the newly
197 * constructed mask bitmap. Ownership of the bitmap is transferred
200 * @param aFilename Filename to be used to construct the item,
201 * if no matching item was found in the currently active skin.
203 * @param aFileBitmapId ID of the bitmap in the file.
204 * Used only if no matching item was found in the currently
207 * @param aFileMaskId ID of the mask in the file.
208 * Used only if no matching item was found in the currently
212 * If data construction fails or bitmap is not found, the function
213 * leaves with an error code.
215 IMPORT_C static void CreateIconL(
216 MAknsSkinInstance* aInstance, const TAknsItemID& aID,
217 CFbsBitmap*& aBitmap, CFbsBitmap*& aMask,
218 const TDesC& aFilename,
219 const TInt aFileBitmapId, const TInt aFileMaskId );
222 * Otherwise identical to CreateIconL, but leaves both the bitmaps
223 * in the cleanup stack.
224 * The order in which they are pushed into the stack and types of
225 * the items in the stack are both undefined.
227 * @copydoc AknsUtils::CreateIconL(MAknsSkinInstance*,TAknsItemID&,CFbsBitmap*&,CFbsBitmap*&,const TDesC&,const TInt,const TInt)
230 * Since both the bitmaps are left in the cleanup stack,
231 * call to this method can not be enclosed in an immediate TRAP.
233 IMPORT_C static void CreateIconLC(
234 MAknsSkinInstance* aInstance, const TAknsItemID& aID,
235 CFbsBitmap*& aBitmap, CFbsBitmap*& aMask,
236 const TDesC& aFilename,
237 const TInt aFileBitmapId, const TInt aFileMaskId );
240 * Constructs an independent non-masked bitmap with fallback support.
241 * Creates an independent (in terms of instance ownership) copy of a
242 * non-masked bitmap by the given item ID.
244 * If no matching item is found in the currently activate skin,
245 * attempts to construct the item using the given file.
251 * @param aInstance Pointer to the current skin instance.
252 * Usually retrieved using @c AknsUtils::SkinInstance.
254 * @param aID Item ID of the non-masked bitmap to be created.
256 * @param aBitmap If method succeeds, set to point to the
257 * newly constructed bitmap. Ownership of the bitmap is transferred
260 * @param aFilename Filename to be used to construct the item,
261 * if no matching item was found in the currently active skin.
263 * @param aFileBitmapId ID of the bitmap in the file.
264 * Used only if no matching item was found in the currently
268 * If data construction fails or bitmap is not found, the function
269 * leaves with an error code.
271 IMPORT_C static void CreateIconL(
272 MAknsSkinInstance* aInstance, const TAknsItemID& aID,
273 CFbsBitmap*& aBitmap,
274 const TDesC& aFilename,
275 const TInt aFileBitmapId );
278 * Otherwise identical to CreateIconL, but leaves the bitmap
279 * in the cleanup stack.
280 * The type of the item pushed into the stack is undefined.
282 * @copydoc AknsUtils::CreateIconL(MAknsSkinInstance*,TAknsItemID&,CFbsBitmap*&,const TDesC&,const TInt)
285 * Since the bitmap is left in the cleanup stack,
286 * call to this method can not be enclosed in an immediate TRAP.
288 IMPORT_C static void CreateIconLC(
289 MAknsSkinInstance* aInstance, const TAknsItemID& aID,
290 CFbsBitmap*& aBitmap,
291 const TDesC& aFilename,
292 const TInt aFileBitmapId );
295 * Constructs an independent masked bitmap with fallback support.
296 * Creates an independent (in terms of instance ownership) copy of a
297 * masked bitmap by the given item ID.
299 * If no matching item is found in the currently activate skin,
300 * attempts to construct the item using the given file.
306 * @param aInstance Pointer to the current skin instance.
308 * @param aID Item ID of the masked bitmap to be created.
310 * @param aFilename Filename to be used to construct the item,
311 * if no matching item was found in the currently active skin.
313 * @param aFileIndex Index (for bitmap) in the file.
314 * Used only if no matching item was found in the currently
317 * @param aFileMaskIndex Index (for mask) in the file.
318 * Used only if no matching item was found in the currently
321 * @return Pointer to the newly created CApaMaskedBitmap object.
322 * Ownership of the object is transferred to the caller.
325 * If data construction fails or bitmap is not found, the function
326 * leaves with an error code.
329 * Since @c CApaMaskedBitmap can not be used to store scalable
330 * graphics, consider using @c CreateIconLC instead.
332 IMPORT_C static CApaMaskedBitmap* CreateMaskedBitmapL(
333 MAknsSkinInstance* aInstance, const TAknsItemID& aID,
334 const TDesC& aFilename,
335 const TInt aFileIndex, const TInt aFileMaskIndex );
338 * Constructs an independent CGulIcon object with fallback support.
339 * Creates an independent (in terms of instance ownership) copy of a
340 * masked bitmap by the given item ID, and returns it as a
341 * newly constructed CGulIcon object.
343 * If no matching item is found in the currently active skin,
344 * attempts to construct the item using the given file.
350 * @param aInstance Pointer to the current skin instance.
352 * @param aID Item ID of the masked bitmap to be created.
354 * @param aFilename Filename to be used to construct the item,
355 * if no matching item was found in the currently active skin.
357 * @param aFileIndex Index (for bitmap) in the file.
358 * Used only if no matching item was found in the currently
361 * @param aFileMaskIndex Index (for mask) in the file.
362 * Used only if no matching item was found in the currently
365 * @return Pointer to the newly created CGulIcon object.
366 * Ownership of the object is transferred to the caller.
369 * If data construction fails or bitmap is not found, the function
370 * leaves with an error code.
372 IMPORT_C static CGulIcon* CreateGulIconL(
373 MAknsSkinInstance* aInstance, const TAknsItemID& aID,
374 const TDesC& aFilename,
375 const TInt aFileIndex, const TInt aFileMaskIndex );
378 * Constructs an application icon supporting scalable graphics.
380 * This method is fallback-enabled. If no icon is found in the
381 * currently active skin, the application icon is retrieved using
382 * application resource file or AIF.
384 * After successful completion, the method leaves both the bitmaps
385 * in the cleanup stack.
386 * The order in which they are pushed into the stack and types of
387 * the items in the stack are both undefined.
389 * The caller must set the size of the returned bitmaps.
390 * See @c AknIconUtils for details.
393 * Since both the bitmaps are left in the cleanup stack,
394 * call to this method can not be enclosed in an immediate TRAP.
400 * @param aInstance Pointer to current skin instance.
402 * @param aAppUid Application UID. Icon is searched with major IID
403 * ::EAknsIIDMajorAppIcon and minor IID aAppUid.
405 * @param aType Type of the application icon (list or context).
406 * This parameter is tentative. If no icon of the given type
407 * is found, the other icon is returned. Only the following values
408 * are allowed: EAknsAppIconTypeList and EAknsAppIconTypeContext.
410 * @param aBitmap If method succeeds, set to point to the
411 * newly constructed bitmap. Ownership of the bitmap is transferred
414 * @param aMask If method succeeds, set to point to the newly
415 * constructed mask bitmap. Ownership of the bitmap is transferred
419 * If the method fails, it leaves with a standard error code.
421 IMPORT_C static void CreateAppIconLC(
422 MAknsSkinInstance* aInstance, TUid aAppUid,
423 TAknsAppIconType aType,
424 CFbsBitmap*& aBitmap, CFbsBitmap*& aMask );
427 * Opens the file containing application icon data.
429 * This method first checks whether there is a data file of the given
430 * type associated with the application icon of the given UID. If no
431 * file is found, an error code is returned and the caller should use
432 * @c CreateAppIconLC to construct the icon. Otherwise, one of the
433 * associated files is opened using the given @c RFile object.
439 * @param aInstance Pointer to current skin instance.
441 * @param aAppUid Application UID. Icon is searched with major IID
442 * ::EAknsIIDMajorAppIcon and minor IID aAppUid.
444 * @param aType Only EAknsAppIconType3D is allowed.
446 * @param aFile Reference to a @c RFile. If @c KErrNone is returned,
447 * this handle refers to an open file containing the data.
448 * If an error code is returned, the file is not opened.
450 * @return @c KErrNone if a file was opened, an error code otherwise.
452 IMPORT_C TInt OpenAppIconFile(
453 MAknsSkinInstance* aInstance, TUid aAppUid,
454 TAknsAppIconType aType, RFile& aFile );
457 * Constructs an independent masked color-customized icon with
458 * fallback support without setting its size.
460 * Creates an independent (in terms of instance ownership) copy of a
461 * masked bitmap by the given item ID and applies color-based
465 * - Creates a masked bitmap item from skin, or from the given
466 * MBM or MIF file if no matching item is found in the active skin.
467 * - If the icon can be color-skinned, applies the color retrieved
468 * from the given color table and index. If no color information
469 * is found in the active skin, uses the given fallback color value.
470 * - Returns the resulting bitmaps. If no color skinning was applied,
471 * returns the original bitmaps.
473 * The method fails only, if the masked bitmap can not be constructed
474 * at all. If the icon can not be color-skinned, it is returned as-is.
480 * @param aInstance Pointer to the current skin instance.
481 * Usually retrieved using @c AknsUtils::SkinInstance.
483 * @param aID Item ID of the masked bitmap to be created.
485 * @param aColorID Item ID of the color table.
487 * @param aColorIndex Index in the color table.
489 * @param aBitmap If method succeeds, set to point to the
490 * newly constructed bitmap. Ownership of the bitmap is transferred
493 * @param aMask If method succeeds, set to point to the newly
494 * constructed mask bitmap. Ownership of the bitmap is transferred
497 * @param aFilename Filename to be used to construct the item,
498 * if no matching item was found in the currently active skin.
500 * @param aFileBitmapId ID of the bitmap in the file.
501 * Used only if no matching item was found in the currently
504 * @param aFileMaskId ID of the mask in the file.
505 * Used only if no matching item was found in the currently
508 * @param aDefaultColor Color RGB value to be used, if no color
509 * is found in the currently active skin.
512 * If data construction fails or bitmap is not found, the function
513 * leaves with an error code.
515 IMPORT_C static void CreateColorIconL(
516 MAknsSkinInstance* aInstance, const TAknsItemID& aID,
517 const TAknsItemID& aColorID, const TInt aColorIndex,
518 CFbsBitmap*& aBitmap, CFbsBitmap*& aMask,
519 const TDesC& aFilename,
520 const TInt aFileBitmapId, const TInt aFileMaskId,
521 const TRgb aDefaultColor );
524 * Otherwise identical to @c CreateColorIconL, but leaves both the
525 * bitmap and the mask in the cleanup stack.
526 * The order in which they are pushed into the stack and types of
527 * the items in the stack are both undefined.
534 * Since two bitmaps are left in the cleanup stack,
535 * call to this method can not be enclosed in an immediate TRAP.
537 IMPORT_C static void CreateColorIconLC(
538 MAknsSkinInstance* aInstance, const TAknsItemID& aID,
539 const TAknsItemID& aColorID, const TInt aColorIndex,
540 CFbsBitmap*& aBitmap, CFbsBitmap*& aMask,
541 const TDesC& aFilename,
542 const TInt aFileBitmapId, const TInt aFileMaskId,
543 const TRgb aDefaultColor );
546 * Otherwise identical to @c CreateColorIconL without size parameters,
547 * but calls @c SetSize to set the size of the resulting icon.
553 IMPORT_C static void CreateColorIconL(
554 MAknsSkinInstance* aInstance, const TAknsItemID& aID,
555 const TAknsItemID& aColorID, const TInt aColorIndex,
556 CFbsBitmap*& aBitmap, CFbsBitmap*& aMask,
557 const TDesC& aFilename,
558 const TInt aFileBitmapId, const TInt aFileMaskId,
559 const TRgb aDefaultColor,
560 const TSize& aSize, const TScaleMode aScaleMode );
563 * Otherwise identical to @c CreateColorIconL, but leaves both the
564 * bitmap and the mask in the cleanup stack.
565 * The order in which they are pushed into the stack and types of
566 * the items in the stack are both undefined.
573 * Since two bitmaps are left in the cleanup stack,
574 * call to this method can not be enclosed in an immediate TRAP.
576 IMPORT_C static void CreateColorIconLC(
577 MAknsSkinInstance* aInstance, const TAknsItemID& aID,
578 const TAknsItemID& aColorID, const TInt aColorIndex,
579 CFbsBitmap*& aBitmap, CFbsBitmap*& aMask,
580 const TDesC& aFilename,
581 const TInt aFileBitmapId, const TInt aFileMaskId,
582 const TRgb aDefaultColor,
583 const TSize& aSize, const TScaleMode aScaleMode );
585 public: // New functions - Item access w/o support for scalable graphics
588 * Constructs an application icon. Icon bitmaps are duplicated to the
589 * given CApaMaskedBitmap object.
591 * Since Series 60 Release 2.6, this method is fallback-enabled.
592 * If no icon is found in the currently active skin, it uses
593 * AppArch to construct the icon.
597 * @param aInstance Pointer to current skin instance.
599 * @param aAppUid Application UID. Icon is searched with major IID
600 * ::EAknsIIDMajorAppIcon and minor IID aAppUid. AppArch search
601 * is always performed with UID only.
603 * @param aSize Maximum size of the icon.
605 * @param aAppBitmap On return contains the icon.
607 * @return KErrNone if succeeded, KErrNotFound if no icon was found
608 * or size requirements were not met, other error code if
609 * another error occured.
612 * This method does not support scalable graphics.
613 * Consider using @c CreateAppIconLC instead.
615 IMPORT_C static TInt GetAppIcon(
616 MAknsSkinInstance* aInstance, TUid aAppUid, TSize aSize,
617 CApaMaskedBitmap& aAppBitmap );
619 public: // New functions - Item access w/ ownership
622 * Constructs an independent bitmap.
623 * Creates an independent copy of bitmap (in terms of instance ownership)
628 * @param aInstance Pointer to current skin instance.
630 * @param aID Item ID of the bitmap to be created.
632 * @return Pointer to the newly created bitmap. Ownership of the object
633 * is transferred to the caller.
636 * - If data construction fails or bitmap is not found, function
637 * leaves with an error code.
639 IMPORT_C static CFbsBitmap* CreateBitmapL(
640 MAknsSkinInstance* aInstance, const TAknsItemID& aID );
643 * Constructs an independent masked bitmap.
644 * Creates an independent (in terms of instance ownership) copy of a
645 * masked bitmap by the given item ID.
647 * Alternatively, masked bitmaps can be retrieved by using
648 * @c MAknsSkinInstance::GetCachedItemData(TAknsItemID,TAknsItemType)
650 * @c MAknsSkinInstance::CreateUncachedItemDataL(TAknsItemID,TAknsItemType)
651 * methods. For these, @c ::EAknsITMaskedBitmap should be given as the
652 * second parameter. Returned @c CAknsItemData pointer can be casted
653 * to a @c CAknsMaskedBitmapItemData pointer in order to get access
654 * to the bitmap objects themselves.
657 * This method does not have fallback support (to load the bitmap from
658 * the specified file in case it is not available in the current
659 * skin). Consider using one of the fallback-enabled overloads
664 * @param aInstance Pointer to the current skin instance.
666 * @param aID Item ID of the masked bitmap to be created.
668 * @return Pointer to the newly created CApaMaskedBitmap object.
669 * Ownership of the object is transferred to the caller.
672 * If data construction fails or bitmap is not found, the function
673 * leaves with an error code.
676 * Since @c CApaMaskedBitmap can not be used to store scalable
677 * graphics, consider using @c CreateIconLC instead.
679 IMPORT_C static CApaMaskedBitmap* CreateMaskedBitmapL(
680 MAknsSkinInstance* aInstance, const TAknsItemID& aID );
683 * Constructs an independent CGulIcon object.
684 * Creates an independent (in terms of instance ownership) copy of a
685 * bitmap or a masked bitmap by the given item ID, and returns it as a
686 * newly constructed CGulIcon object.
689 * This method does not have fallback support (to load the bitmap from
690 * the specified file in case it is not available in the current
691 * skin). Consider using one of the fallback-enabled overloads
698 * @param aInstance Pointer to the current skin instance.
700 * @param aID Item ID of the bitmap or masked bitmap to be created.
702 * @param aRequireMask ETrue if masked bitmap is explicitly required.
703 * EFalse if mask is optional.
705 * @return Pointer to the newly created CGulIcon object.
706 * Ownership of the object is transferred to the caller.
709 * If data construction fails or bitmap is not found, the function
710 * leaves with an error code.
712 IMPORT_C static CGulIcon* CreateGulIconL(
713 MAknsSkinInstance* aInstance, const TAknsItemID& aID,
714 const TBool aRequireMask );
716 public: // New functions - Item access w/o ownership
719 * Returns pointer to a cached bitmap.
720 * Retrieves (and constructs if necessary) a bitmap in skin instance
721 * cache. Caller can use the bitmap temporarily (e.g. in drawing code),
722 * but should not store pointer to it, since its lifetime is determined
727 * @param aInstance Pointer to current skin instance. If @c NULL value
728 * is specified, method immediately returns with @c NULL return value.
730 * @param aID Item ID of the bitmap to be retrieved.
732 * @return Pointer to the bitmap, or @c NULL if no bitmap with given ID
733 * was found or an error occured.
736 * - Because the method can not leave, error handling procedure
738 * MAknsSkinInstance::GetCachedItemData(const TAknsItemID& aID) is
739 * used if data construction fails.
741 IMPORT_C static CFbsBitmap* GetCachedBitmap(
742 MAknsSkinInstance* aInstance, const TAknsItemID& aID );
745 * Retrieves temporary pointers to a cached bitmap and its mask.
746 * Retrieves (and constructs, if necessary) a masked bitmap in the skin
747 * instance cache. Pointers to the bitmap (and its mask) are stored
748 * to the pointers given as parameters. Caller can use the bitmaps
749 * temporarily (e.g. in drawing code), but should not store them, since
750 * their lifetimes are determined by the cache.
754 * @param aInstance Pointer to the current skin instance. If @c NULL
755 * value is specified, the method assigns @c NULL to both the given
756 * pointers and then returns.
758 * @param aID Item ID of the bitmap (or masked bitmap) to be retrieved.
760 * @param aBitmap Reference to the pointer that will receive the bitmap.
761 * @c NULL value is assigned if no bitmap with the given ID was found
762 * or an error occured.
764 * @param aMask Reference to the pointer that will receive the mask.
765 * @c NULL value is assigned if no bitmap with the given ID was found,
766 * or the bitmap did not have a mask, or an error occured.
769 * - Because the method can not leave, error handling procedure
771 * MAknsSkinInstance::GetCachedItemData(const TAknsItemID& aID) is
772 * used if data construction fails.
774 IMPORT_C static void GetCachedMaskedBitmap(
775 MAknsSkinInstance* aInstance, const TAknsItemID& aID,
776 CFbsBitmap*& aBitmap, CFbsBitmap*& aMask );
779 * Returns a color value from a cached color table.
780 * Retrieves (and constructs if necessary) a color table in
781 * skin instance cache and returns a color value from it.
783 * Since release 2.8, this method also handles any backward
784 * compatibility operations possibly required.
788 * @param aInstance Pointer to current skin instance. If @c NULL value
789 * is specified, returns KErrNotSupported.
791 * @param aRgb Reference to a TRgb that will receive the color.
793 * @param aID Item ID of the color table.
795 * @param aIndex Index of the color in the color table.
797 * @return KErrNone if successful, otherwise an error code is returned.
799 IMPORT_C static TInt GetCachedColor(
800 MAknsSkinInstance* aInstance, TRgb& aRgb, const TAknsItemID& aID,
804 * Retrieves the value of the given boolean property skin item.
808 * @param aInstance Pointer to current skin instance. If @c NULL value
809 * is specified, the method leaves.
811 * @param aID Item ID of the boolean property.
813 * @return Value of the boolean property as @c TBool.
816 * - If the item is not found, leaves with @c KErrNotFound.
817 * - If the item is not a boolean property or another error occures,
818 * leaves with a system-wide error code.
820 IMPORT_C static TBool BooleanPropertyL( MAknsSkinInstance* aInstance,
821 const TAknsItemID& aID );
824 * Test whether the given type is derived from the given base type.
828 * @param aBaseType Base type.
830 * @param aDerivedType Derived type.
832 * @return ETrue if the type is derived from the base type, EFalse
837 static TBool IsDerivedType( const TAknsItemType aBaseType,
838 const TAknsItemType aDerivedType );
840 public: // New functions - Avkon parameters
843 * Sets the flag indicating whether default skin parameters should
844 * be used for newly created Avkon controls in the scope of the
849 * @param Value of the flag as TBool.
852 * If construction of the storage object for the flag fails,
853 * leaves with an error code.
855 IMPORT_C static void SetAvkonSkinEnabledL( const TBool aEnabled );
858 * Queries whether default skin parameters should be used for newly
859 * created Avkon controls. Components supporting
860 * <code>SetSkinEnabledL</code> method should also check for this
861 * value upon construction and set their internal state accordingly.
863 * Note that this flag is intended to be used to determine whether or
864 * not controls should create skin backgrounds for main pane
865 * layouts. Skins are always enabled for e.g. all the popup windows,
866 * even through the flag may be @c EFalse, and therefore the flag
867 * must not be used as a generic "are skins enabled" switch.
869 * Most controls do not (and should not) query the flag value. If
870 * control just fetches the skin control context with
871 * @c AknsDrawUtils::ControlContext, it will get the proper @c NULL
872 * value if no background has been defined.
876 * @return ETrue if default skin parameters should be used,
877 * EFalse otherwise. The default value is EFalse.
879 IMPORT_C static TBool AvkonSkinEnabled();
882 * Sets the flag indicating whether highlight animations should be used
883 * for Avkon list controls in the scope of the current AppUi.
887 * @param Value of the flag as TBool.
890 * If construction of the storage object for the flag fails,
891 * leaves with an error code.
893 IMPORT_C static void SetAvkonHighlightAnimationEnabledL( const TBool aEnabled );
896 * Queries whether highlight animation should be used for newly created
897 * Avkon list controls.
901 * @return ETrue if list highlight animation should be used, EFalse
902 * otherwise. The default value is ETrue.
904 IMPORT_C static TBool AvkonHighlightAnimationEnabled();
906 public: // New functions - Control position list
909 * Registers the position of the given control.
910 * The position is stored in the thread-local control position list.
911 * If the control has already been registered, its position is updated.
913 * Registering the position of the control enables background drawing
914 * methods in AknsDrawUtils to calculate positions in
915 * parent-absolute layouts without causing window server flushes.
917 * When a registered control goes out of scope, it must call
918 * AknsUtils::DeregisterControlPosition to ensure that it is properly
919 * removed from the list.
923 * @param aControl Pointer to the control that needs its position
924 * to be updated in the control position list.
926 IMPORT_C static void RegisterControlPosition(
927 const CCoeControl* aControl );
930 * Registers the position of the given control with given position.
931 * The position is stored in the thread-local control position list.
932 * If the control has already been registered, its position is updated.
934 * Registering the position of the control enables background drawing
935 * methods in AknsDrawUtils to calculate positions in
936 * parent-absolute layouts without causing window server flushes.
938 * When a registered control goes out of scope, it must call
939 * AknsUtils::DeregisterControlPosition to ensure that it is properly
940 * removed from the list.
944 * @param aControl Pointer to the control that needs its position
945 * to be updated in the control position list.
947 * @param aPoint The new position to be registered with the given
948 * control (in screen coordinates).
950 IMPORT_C static void RegisterControlPosition(
951 const CCoeControl* aControl, const TPoint& aPoint );
954 * Removes the position of the given control from the list.
955 * The position of the given control is removed from the thread-local
956 * control position list. If the control has not been registered,
957 * this method does nothing.
961 * @param aControl Pointer to the control that needs to be removed
962 * from the control position list.
964 IMPORT_C static void DeregisterControlPosition(
965 const CCoeControl* aControl );
968 * Gets the position of the control registered in the control position
971 * @param aControl Pointer to the control whose position is to be
974 * @param aScreenPos Reference to the TPoint that will receive the
977 * @return KErrNone if successful, KErrNotFound if the control has
978 * not been registered.
980 IMPORT_C static TInt GetControlPosition( const CCoeControl* aControl,
981 TPoint& aScreenPos );
983 private: // Internal methods
986 * Gets an application icon from skin.
992 static TInt GetAppIconFromSkin(
993 MAknsSkinInstance* aInstance, TUid aAppUid, TSize aSize,
994 CFbsBitmap*& aBitmap, CFbsBitmap*& aMask );
997 * Returns the best application icon bitmap IID among the listed icons.
1001 * @param aSize Maximum size.
1003 * @param aSkin Skin instance.
1005 * @param aAppIconIID Item ID of the application icon.
1007 * @return Icon bitmap IID.
1011 static TAknsItemID SelectBestAppIconBitmapL(
1012 const TSize& aSize, MAknsSkinInstance* aSkin,
1013 const TAknsItemID& aAppIconIID );
1015 private: // Reserved exports
1018 * Reserved for future use.
1022 * @return Always returns zero.
1024 IMPORT_C static TInt Reserved();
1026 private: // Prohibited constructors and destructor
1028 // Construction prohibited (static class)
1030 // Destruction prohibited (static class)
1034 #endif // AKNSUTILS_H