1 /* |
|
2 * Copyright (c) 2007 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: Mesh visual attribute setter header. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef ALFMESHVISUALATTRIBUTESETTER_H |
|
20 #define ALFMESHVISUALATTRIBUTESETTER_H |
|
21 |
|
22 #include <osn/osndefines.h> |
|
23 #include "alf/alfcommonvisualattributesetter.h" |
|
24 |
|
25 class CAlfMeshVisual; |
|
26 |
|
27 namespace Alf |
|
28 { |
|
29 class AlfMeshVisualAttributeSetterImpl; |
|
30 class AlfAttribute; |
|
31 |
|
32 /** @class AlfMeshVisualAttributeSetter alfmeshvisualattributesetter.h "alf/alfmeshvisualattributesetter.h" |
|
33 * The implementation of the attribute setter. |
|
34 * |
|
35 * @interfaces IAlfAttributeSetter |
|
36 * @lib alfwidgetmodel.lib |
|
37 * @since S60 ?S60_version |
|
38 * @status Draft |
|
39 */ |
|
40 class AlfMeshVisualAttributeSetter : public AlfCommonVisualAttributeSetter |
|
41 { |
|
42 public: |
|
43 |
|
44 /** |
|
45 * Constructor. |
|
46 * |
|
47 * @exception std::bad_alloc |
|
48 * @param aType Type of the attribute setter. |
|
49 */ |
|
50 OSN_IMPORT AlfMeshVisualAttributeSetter(); |
|
51 |
|
52 /** |
|
53 * Destructor. |
|
54 */ |
|
55 OSN_IMPORT virtual ~AlfMeshVisualAttributeSetter(); |
|
56 |
|
57 /** |
|
58 * Sets an attribute value in the target visual . |
|
59 * |
|
60 * @exception osncore::AlfVisualException Thrown with the error code osncore::EInvalidVisual\n |
|
61 * when supplied visual is not a Mesh visual. |
|
62 * @exception osncore::AlfDataException Thrown with the error code osncore::EInvalidVariantDataType\n |
|
63 * when no data for line visual is supplied. |
|
64 * @exception osncore::AlfDataException Thrown with the error code osncore::EInvalidAttribute\n |
|
65 * when wrong data for line visual is supplied. |
|
66 * @param aVisual The target visual. Doesn't take ownership |
|
67 * @param aContainer The container holding the new value of the attribute. |
|
68 * Ownership of the object is not transferred. |
|
69 * @param aData Used with data attributes to fetch the data. |
|
70 */ |
|
71 OSN_IMPORT virtual void setAttributeValue( |
|
72 CAlfVisual &aVisual, |
|
73 AlfAttributeContainer* aContainer, |
|
74 IAlfMap* aData); |
|
75 |
|
76 /** |
|
77 * Creates a command to change the value of an attribute in the target |
|
78 * visual gradually with a transition. |
|
79 * |
|
80 * @param aVisual The target visual. Doesn't take ownership |
|
81 * @param aContainer The container holding the new value of the attribute. |
|
82 * Ownership of the object is not transferred. |
|
83 * @param aData Not used currently. |
|
84 * @param aTransitionTime Time used for the transition. |
|
85 * @param aRefVisual Optional reference visual. If not NULL, the target |
|
86 * value of the attribute is defined by adding the value |
|
87 * specific by aContainer to the corresponding attribute |
|
88 * value in the reference visual. |
|
89 * @ret The command to gradually change the attribute in the target visual |
|
90 */ |
|
91 OSN_IMPORT virtual TAlfCommand* createCommand( |
|
92 CAlfVisual& aVisual, |
|
93 AlfAttributeContainer* aContainer, |
|
94 IAlfMap* aData, |
|
95 int aTransitionTime = 0, |
|
96 CAlfVisual* aRefVisual = NULL ); |
|
97 |
|
98 /** |
|
99 * Creates commands to change the given attribute values in the target |
|
100 * visual gradually with a transition.Then sends the commands via the |
|
101 * ALF environment. |
|
102 * |
|
103 * @param aVisual The target visual. Doesn't take ownership |
|
104 * @param aContainer The attribute container holding the attribute |
|
105 * value(s) used by the attribute setter. Ownership |
|
106 * is not transferred. The container can hold new values |
|
107 * for multiple different attributes, in which case |
|
108 * several commands are executed. |
|
109 * @param aRefVisual Optional reference visual. If not NULL, the target |
|
110 * value of the attribute is defined by adding the value |
|
111 * specific by aContainer to the corresponding attribute |
|
112 * value in the reference visual. |
|
113 */ |
|
114 OSN_IMPORT virtual void createAndSendCommands( |
|
115 CAlfVisual& aVisual, |
|
116 AlfAttributeContainer* aContainer, |
|
117 CAlfVisual* aRefVisual = NULL ); |
|
118 |
|
119 protected: |
|
120 |
|
121 /** |
|
122 * Sets an dynamic attribute value in the target visual using transitions |
|
123 * defined in attributes |
|
124 * |
|
125 * @param aVisual The target visual. Doesn't take ownership |
|
126 * @param aAttr The attribute to process. Doesn't take ownership |
|
127 * @param aContainer The container holding attributes. Ownership of the |
|
128 * object is not transferred. |
|
129 */ |
|
130 virtual void handleDynamicAttribute(CAlfVisual &aVisual, AlfAttribute& aAttr, |
|
131 AlfAttributeContainer& aContainer); |
|
132 |
|
133 /** |
|
134 * Sets an value for static attribute in the target visual immediately |
|
135 * without a transition using data in map. |
|
136 * |
|
137 * @param aVisual The target visual. Doesn't take ownership |
|
138 * @param aAttr The attribute to process. Doesn't take ownership |
|
139 * @param aContainer The container holding attributes. Ownership of the |
|
140 * object is not transferred. |
|
141 * @param aData Contains data.Ownership of the object is not transferred. |
|
142 */ |
|
143 virtual void handleStaticDataAttribute(CAlfVisual &aVisual, AlfAttribute& aAttr, |
|
144 AlfAttributeContainer& aContainer, IAlfMap* aData); |
|
145 |
|
146 /** |
|
147 * Sets an value for dynamic attribute value in the target visual using |
|
148 * transitions and data in map. |
|
149 * |
|
150 * @param aVisual The target visual. Doesn't take ownership |
|
151 * @param aAttr The attribute to process. Doesn't take ownership |
|
152 * @param aContainer The container holding attributes. Ownership of the |
|
153 * object is not transferred. |
|
154 * @param aData Contains data.Ownership of the object is not transferred. |
|
155 */ |
|
156 virtual void handleDynamicDataAttribute(CAlfVisual &aVisual, AlfAttribute& aAttr, |
|
157 AlfAttributeContainer& aContainer, IAlfMap* aData); |
|
158 |
|
159 /** |
|
160 * Sets an value of a static attribute to target visual immediately without a transition. |
|
161 * |
|
162 * @param aVisual The target visual. Doesn't take ownership |
|
163 * @param aAttr The attribute to process. Doesn't take ownership |
|
164 * @param aContainer The container holding attributes. Ownership of the object is not transferred. |
|
165 */ |
|
166 virtual void handleStaticAttribute(CAlfVisual &aVisual, AlfAttribute& aAttr, |
|
167 AlfAttributeContainer& aContainer); |
|
168 |
|
169 private: |
|
170 |
|
171 /** |
|
172 * Sets an dynamic attribute value in the target visual using transitions |
|
173 * defined in attributes |
|
174 * |
|
175 * @param aVisual The target visual. Doesn't take ownership |
|
176 * @param aAttr The attribute to process. Doesn't take ownership |
|
177 * @param aContainer The container holding attributes. Ownership of the |
|
178 * object is not transferred. |
|
179 * @param aImmediate if true, the change is immediate and time value of |
|
180 * the attribute is not used. |
|
181 */ |
|
182 bool doHandleDynamicAttribute(CAlfVisual &aVisual, AlfAttribute& aAttr, |
|
183 AlfAttributeContainer& aContainer, bool aImmediate = false); |
|
184 |
|
185 |
|
186 /** |
|
187 * Sets an value for dynamic attribute value in the target visual using |
|
188 * transitions and data in map. |
|
189 * |
|
190 * @param aVisual The target visual. Doesn't take ownership |
|
191 * @param aAttr The attribute to process. Doesn't take ownership |
|
192 * @param aContainer The container holding attributes. Ownership of the |
|
193 * object is not transferred. |
|
194 * @param aData Contains data.Ownership of the object is not transferred. |
|
195 * @param aImmediate if true, the change is immediate and time value of |
|
196 * the attribute is not used. |
|
197 */ |
|
198 bool doHandleDynamicDataAttribute(CAlfVisual &aVisual, AlfAttribute& aAttr, |
|
199 AlfAttributeContainer& aContainer, IAlfMap* aData, bool aImmediate = false); |
|
200 |
|
201 /** |
|
202 * Gets the data from map pointed by attribute's field name. |
|
203 * |
|
204 * @param aAttr The attribute to process. Doesn't take ownership |
|
205 * @param aData Contains data.Ownership of the object is not transferred. |
|
206 * |
|
207 * @return pointer to the data from map pointed by attribute's field name. |
|
208 */ |
|
209 IAlfVariantType* getData(AlfAttribute& aAttr, IAlfMap* aData); |
|
210 |
|
211 /** |
|
212 * gets the time from attribute safely. |
|
213 * |
|
214 * @param aAttr The attribute to process. Doesn't take ownership |
|
215 * @param aImmediate if true, returns 0 else the time set for the attribute |
|
216 */ |
|
217 int getTime(const AlfAttribute& aAttr, bool aImmediate = false); |
|
218 |
|
219 enum imageCategory |
|
220 { |
|
221 primary, |
|
222 secondary, |
|
223 specular |
|
224 }; |
|
225 |
|
226 void HandleImagePathAttribute( |
|
227 const TPtrC8& aStringValue, |
|
228 CAlfMeshVisual* aImageVisual, |
|
229 imageCategory aImageCategory ); |
|
230 |
|
231 private: // data |
|
232 auto_ptr<AlfMeshVisualAttributeSetterImpl> mImpl; |
|
233 |
|
234 }; |
|
235 |
|
236 } // namespace Alf |
|
237 |
|
238 #endif // ALFMESHVISUALATTRIBUTESETTER_H |
|
239 |
|