|
1 /* |
|
2 * Copyright (c) 2007-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: Layered background control context with mask bitmap. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef C_AKNSMASKEDLAYERBACKGROUNDCONTROLCONTEXT_H |
|
20 #define C_AKNSMASKEDLAYERBACKGROUNDCONTROLCONTEXT_H |
|
21 |
|
22 |
|
23 // INCLUDES |
|
24 #include <AknsLayeredBackgroundControlContext.h> |
|
25 #include <AknsSkinInstance.h> |
|
26 #include <bitdev.h> |
|
27 #include <bitstd.h> |
|
28 |
|
29 /** |
|
30 * Implementation of a control context that provides one or more layered |
|
31 * backgrounds with their layout rectangles and has a mask bitmap that |
|
32 * allows drawing of the layers as partially transparent. |
|
33 * |
|
34 * The class is not intended for derivation outside the library. |
|
35 * |
|
36 * @lib AknSkins.lib |
|
37 * |
|
38 * @since S60 v5.0 |
|
39 */ |
|
40 NONSHARABLE_CLASS( CAknsMaskedLayerBackgroundControlContext ) : |
|
41 public CAknsLayeredBackgroundControlContext |
|
42 { |
|
43 public: |
|
44 /** |
|
45 * Two-phased constructor. |
|
46 * |
|
47 * @param aImageID Item ID of the first background bitmap. |
|
48 * |
|
49 * @param aRect Rectangle where the first bitmap should be laid out. |
|
50 * |
|
51 * @param aParentAbsolute ETrue if parent absolute layout should be |
|
52 * used, EFalse otherwise. If a parent absolute layout is used, |
|
53 * the parent position must be set and updated using SetParentPos. |
|
54 * |
|
55 * @param aNumberOfLayers Total number of layers as an integer. |
|
56 * This must be 1 or more. |
|
57 * |
|
58 * @return Newly constructed object. |
|
59 */ |
|
60 IMPORT_C static CAknsMaskedLayerBackgroundControlContext* NewL( |
|
61 const TAknsItemID& aImageID, const TRect& aRect, |
|
62 const TBool aParentAbsolute, const TInt aNumberOfLayers ); |
|
63 |
|
64 /** |
|
65 * Destructor. |
|
66 */ |
|
67 virtual ~CAknsMaskedLayerBackgroundControlContext(); |
|
68 |
|
69 public: // New functions |
|
70 |
|
71 /** |
|
72 * Sets the item ID of the specified layer. |
|
73 * |
|
74 * @param aLayer Index of the layer, where 0 is the first one. |
|
75 * The index must be less than aNumberOfLayers given to @c NewL(). |
|
76 * |
|
77 * @param aID Item ID of the image. |
|
78 */ |
|
79 IMPORT_C void SetLayerImage( const TInt aLayer, |
|
80 const TAknsItemID& aID ); |
|
81 |
|
82 /** |
|
83 * Sets the layout rectangle of the specified layer. |
|
84 * |
|
85 * @param aLayer Index of the layer, where 0 is the first one. |
|
86 * The index must be less than aNumberOfLayers given to @c NewL(). |
|
87 * |
|
88 * @param aRect Rectangle where the image should be laid out. |
|
89 */ |
|
90 IMPORT_C void SetLayerRect( const TInt aLayer, |
|
91 const TRect& aRect ); |
|
92 |
|
93 /** |
|
94 * Sets layer mask IID and its size. No mask is set, if the zero layer |
|
95 * (bottom) does not have image set up. |
|
96 * |
|
97 * @param aIID Item ID of the mask image. If setting KAknsIIDNone |
|
98 * deletes previously created member data. |
|
99 * |
|
100 * @param aRect Rectangle where the mask image should be laid out. |
|
101 */ |
|
102 IMPORT_C void SetLayerMaskAndSizeL(const TAknsItemID& aIID, const TRect& aRect ); |
|
103 |
|
104 public: // From MAknsControlContext |
|
105 |
|
106 /** |
|
107 * @copydoc MAknsControlContext::IsCompatibleWithType |
|
108 */ |
|
109 TBool IsCompatibleWithType( const TAknsControlContextType aType ) const; |
|
110 |
|
111 protected: |
|
112 |
|
113 /** |
|
114 * C++ constructor. |
|
115 */ |
|
116 CAknsMaskedLayerBackgroundControlContext(); |
|
117 |
|
118 /** |
|
119 * Symbian 2nd phase constructor. |
|
120 */ |
|
121 void ConstructL( const TRect& aRect, const TBool aParentAbsolute, |
|
122 const TAknsItemID& aImageID, const TInt aNumberOfLayers ); |
|
123 |
|
124 protected: // Data |
|
125 |
|
126 /* |
|
127 * Layer mask image. |
|
128 * Own. |
|
129 * |
|
130 */ |
|
131 CFbsBitmap* iLayerMask; |
|
132 |
|
133 /* |
|
134 * Offscreen bitmap in which are drawn all the layers |
|
135 * (without mask). |
|
136 * Own. |
|
137 * |
|
138 */ |
|
139 CFbsBitmap* iOffScreenBmp; |
|
140 |
|
141 /* |
|
142 * Offscreen graphics device. |
|
143 * Own. |
|
144 * |
|
145 */ |
|
146 CFbsBitmapDevice* iOffScreenDevice; |
|
147 |
|
148 /* |
|
149 * Offscreen bitmap graphics context.. |
|
150 * Own. |
|
151 * |
|
152 */ |
|
153 CFbsBitGc* iOffScreenGc; |
|
154 |
|
155 friend class AknsDrawUtils; |
|
156 }; |
|
157 |
|
158 |
|
159 #endif // C_AKNSLAYERFRAMEBACKGROUNDCONTROLCONTEXT_H |