|
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: attributesetter for common visual attributes |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef ALFCOMMONVISUALATTRIBUTESETTER_H |
|
20 #define ALFCOMMONVISUALATTRIBUTESETTER_H |
|
21 |
|
22 #include <osn/osndefines.h> |
|
23 #include <memory> |
|
24 #include <osn/ustring.h> |
|
25 #include "alf/alfcommonattributesetter.h" |
|
26 |
|
27 using namespace osncore; |
|
28 |
|
29 using std::auto_ptr; |
|
30 |
|
31 namespace Alf |
|
32 { |
|
33 |
|
34 /** |
|
35 * @class AlfCommonVisualAttributeSetter alfcommonvisualattributesetter.h "alf/alfcommonvisualattributesetter.h" |
|
36 * Base implementation for visual attribute setters. Attribute setters for custom visuals can derive from this |
|
37 * class. |
|
38 * @see IAlfAttributeSetter |
|
39 * |
|
40 * @lib alfwidgetmodel.lib |
|
41 * @since S60 ?S60_version |
|
42 * @status Draft |
|
43 * @interfaces IAlfAttributeSetter |
|
44 */ |
|
45 class AlfCommonVisualAttributeSetter : public AlfCommonAttributeSetter |
|
46 { |
|
47 public: |
|
48 |
|
49 /** |
|
50 * Constructor. |
|
51 * |
|
52 */ |
|
53 OSN_IMPORT AlfCommonVisualAttributeSetter(); |
|
54 |
|
55 /** |
|
56 * Destructor. |
|
57 */ |
|
58 OSN_IMPORT virtual ~AlfCommonVisualAttributeSetter(); |
|
59 |
|
60 /** |
|
61 * Creates a command to change the value of an attribute |
|
62 * in the target visual gradually with a transition. |
|
63 * |
|
64 * @since S60 ?S60_version |
|
65 * @param aVisual The target visual. Doesn't take ownership |
|
66 * @param aContainer The container holding the new value of the attribute. |
|
67 * Ownership of the object is not transferred. |
|
68 * @param aData Not used currently. |
|
69 * @param aTransitionTime Time used for the transition. |
|
70 * @param aRefVisual Optional reference visual. If not NULL, |
|
71 * the target value of the attribute is defined by adding |
|
72 * the value specific by aContainer to the corresponding |
|
73 * attribute value in the reference visual. |
|
74 * @return The command to gradually change the attribute in the target visual. |
|
75 */ |
|
76 OSN_IMPORT virtual TAlfCommand* createCommand( |
|
77 CAlfVisual& aVisual, |
|
78 AlfAttributeContainer* aContainer, |
|
79 IAlfMap* aData, |
|
80 int aTransitionTime = 0, |
|
81 CAlfVisual* aRefVisual = NULL ); |
|
82 |
|
83 /** |
|
84 * Creates commands to change the given attribute values |
|
85 * in the target visual gradually with a transition. |
|
86 * Then sends the commands via the ALF environment. |
|
87 * |
|
88 * @since S60 ?S60_version |
|
89 * @param aVisual The target visual. Doesn't take ownership |
|
90 * @param aContainer The attribute container holding the attribute value(s) |
|
91 * used by the attribute setter. Ownership is not transferred. |
|
92 * The container can hold new values for multiple different |
|
93 * attributes, in which case several commands are executed. |
|
94 * @param aRefVisual Optional reference visual. If not NULL, |
|
95 * the target value of the attribute is defined by adding the value |
|
96 * specific by aContainer to the corresponding attribute value |
|
97 * in the reference visual. |
|
98 */ |
|
99 OSN_IMPORT virtual void createAndSendCommands( |
|
100 CAlfVisual& aVisual, |
|
101 AlfAttributeContainer* aContainer, |
|
102 CAlfVisual* aRefVisual = NULL ); |
|
103 |
|
104 protected: |
|
105 |
|
106 /** |
|
107 * From AlfCommonAttributeSetter |
|
108 * Sets a value of a static attribute to target visual immediately without a transition. |
|
109 * |
|
110 * @param aVisual The target visual. Ownership not passed. |
|
111 * @param aAttr The attribute to process. Ownership not passed. |
|
112 * @param aContainer The container holding attributes. Ownership not passed. |
|
113 */ |
|
114 virtual void handleStaticAttribute(CAlfVisual& aVisual, AlfAttribute& aAttr, |
|
115 AlfAttributeContainer& aContainer); |
|
116 |
|
117 /** |
|
118 * From AlfCommonAttributeSetter |
|
119 * Sets a dynamic attribute value in the target visual using transitions defined in attributes |
|
120 * |
|
121 * @param aVisual The target visual. Ownership not passed. |
|
122 * @param aAttr The attribute to process. Ownership not passed. |
|
123 * @param aContainer The container holding attributes. Ownership not passed. |
|
124 */ |
|
125 virtual void handleDynamicAttribute(CAlfVisual& aVisual, AlfAttribute& aAttr, |
|
126 AlfAttributeContainer& aContainer); |
|
127 |
|
128 /** |
|
129 * From AlfCommonAttributeSetter |
|
130 * Sets a value for static data attribute in the target visual |
|
131 * immediately without a transition using data in map. |
|
132 * |
|
133 * @param aVisual The target visual. Ownership not passed. |
|
134 * @param aAttr The attribute to process. Ownership not passed. |
|
135 * @param aContainer The container holding attributes. Ownership not passed. |
|
136 * @param aData Contains data. Ownership not passed. |
|
137 */ |
|
138 virtual void handleStaticDataAttribute(CAlfVisual& aVisual, AlfAttribute& aAttr, |
|
139 AlfAttributeContainer& aContainer, IAlfMap* aData); |
|
140 |
|
141 /** |
|
142 * From AlfCommonAttributeSetter |
|
143 * Sets a value for dynamic data attribute value in the target visual using transitions and data in map. |
|
144 * |
|
145 * @param aVisual The target visual. Ownership not passed. |
|
146 * @param aAttr The attribute to process. Ownership not passed. |
|
147 * @param aContainer The container holding attributes. Ownership not passed. |
|
148 * @param aData Contains data. Ownership not passed. |
|
149 */ |
|
150 virtual void handleDynamicDataAttribute(CAlfVisual& aVisual, AlfAttribute& aAttr, |
|
151 AlfAttributeContainer& aContainer, IAlfMap* aData); |
|
152 |
|
153 private: |
|
154 |
|
155 /** |
|
156 * Sets an dynamic attribute value in the target visual using transitions defined in attributes |
|
157 * |
|
158 * @since S60 ?S60_version |
|
159 * @param aVisual The target visual. Doesn't take ownership |
|
160 * @param aAttr The attribute to process. Doesn't take ownership |
|
161 * @param aContainer The container holding attributes. Ownership of the object is not transferred. |
|
162 * @param aData Contains data.Ownership of the object is not transferred. |
|
163 * @param aImmediate if true, the change is immediate and time value of the attribute is not used. |
|
164 * @return true, if attribute was handled, false otherwise. |
|
165 */ |
|
166 bool doHandleDynamicAttribute(CAlfVisual &aVisual, AlfAttribute& aAttr, |
|
167 AlfAttributeContainer& aContainer, bool aImmediate = false); |
|
168 |
|
169 /** |
|
170 * Sets an value for dynamic attribute value in the target visual using transitions and data in map. |
|
171 * |
|
172 * @since S60 ?S60_version |
|
173 * @param aVisual The target visual. Doesn't take ownership |
|
174 * @param aAttr The attribute to process. Doesn't take ownership |
|
175 * @param aContainer The container holding attributes. Ownership of the object is not transferred. |
|
176 * @param aData Contains data.Ownership of the object is not transferred. |
|
177 * @param aImmediate if true, the change is immediate and time value of the attribute is not used. |
|
178 */ |
|
179 bool doHandleDynamicDataAttribute(CAlfVisual &aVisual, AlfAttribute& aAttr, |
|
180 AlfAttributeContainer& aContainer, IAlfMap* aData, bool aImmediate = false); |
|
181 |
|
182 /** |
|
183 * Creates commands to change the given attribute values in the target visual gradually with a transition. |
|
184 * |
|
185 * @since S60 ?S60_version |
|
186 * @param aVisual The target visual. Doesn't take ownership |
|
187 * @param aContainer The attribute container holding the attribute value(s) |
|
188 * used by the attribute setter. Ownership is not transferred. |
|
189 * @param aAttr main attribute, from which the command is created. |
|
190 The function can also use other attributes found in the aContainer. |
|
191 * @param aRefVisual Optional reference visual. If not NULL, the target value of the attribute is defined by adding |
|
192 * the value specific by aContainer to the corresponding attribute value in the reference visual. |
|
193 */ |
|
194 void sendCommandsForAttribute(CAlfVisual& aVisual, |
|
195 AlfAttributeContainer& aContainer, AlfAttribute& aAttr, |
|
196 CAlfVisual* aRefVisual); |
|
197 |
|
198 /** |
|
199 * Sets an value of a static attribute to target visual immediately without a transition. |
|
200 * |
|
201 * @since S60 ?S60_version |
|
202 * @param aVisual The target visual. Doesn't take ownership |
|
203 * @param aContainer The container holding attributes. Ownership of the object is not transferred. |
|
204 * @param aData Contains data.Ownership of the object is not transferred. |
|
205 */ |
|
206 void setPadding(CAlfVisual &aVisual,AlfAttributeContainer& aContainer,IAlfMap* aData); |
|
207 /** |
|
208 * Sets an value of a static attribute to target visual immediately without a transition. |
|
209 * |
|
210 * @since S60 ?S60_version |
|
211 * @param aVisual The target visual. Doesn't take ownership |
|
212 * @param aContainer The container holding attributes. Ownership of the object is not transferred. |
|
213 * @param aData Contains data.Ownership of the object is not transferred. |
|
214 */ |
|
215 void setMinSize(CAlfVisual &aVisual,AlfAttributeContainer& aContainer,IAlfMap* aData); |
|
216 /** |
|
217 * Sets an value of a static attribute to target visual immediately without a transition. |
|
218 * |
|
219 * @since S60 ?S60_version |
|
220 * @param aVisual The target visual. Doesn't take ownership |
|
221 * @param aContainer The container holding attributes. Ownership of the object is not transferred. |
|
222 * @param aData Contains data.Ownership of the object is not transferred. |
|
223 */ |
|
224 void setMaxSize(CAlfVisual &aVisual,AlfAttributeContainer& aContainer,IAlfMap* aData); |
|
225 |
|
226 /** |
|
227 * Sets an dynamic attribute value in the target visual using transitions defined in attributes. |
|
228 * |
|
229 * @since S60 ?S60_version |
|
230 * @param aVisual The target visual. Doesn't take ownership |
|
231 * @param aContainer The container holding attributes. Ownership of the object is not transferred. |
|
232 * @param aData Contains data.Ownership of the object is not transferred. |
|
233 */ |
|
234 |
|
235 void setPos(CAlfVisual &aVisual,AlfAttributeContainer& aContainer,IAlfMap* aData,bool aImmediate); |
|
236 /** |
|
237 * Sets an dynamic attribute value in the target visual using transitions defined in attributes. |
|
238 * |
|
239 * @since S60 ?S60_version |
|
240 * @param aVisual The target visual. Doesn't take ownership |
|
241 * @param aContainer The container holding attributes. Ownership of the object is not transferred. |
|
242 * @param aData Contains data.Ownership of the object is not transferred. |
|
243 */ |
|
244 |
|
245 void setSize(CAlfVisual &aVisual,AlfAttributeContainer& aContainer,IAlfMap* aData,bool aImmediate); |
|
246 /** |
|
247 * Sets an dynamic attribute value in the target visual using transitions defined in attributes. |
|
248 * |
|
249 * @since S60 ?S60_version |
|
250 * @param aVisual The target visual. Doesn't take ownership |
|
251 * @param aContainer The container holding attributes. Ownership of the object is not transferred. |
|
252 * @param aData Contains data.Ownership of the object is not transferred. |
|
253 */ |
|
254 |
|
255 void setRect(CAlfVisual &aVisual,AlfAttributeContainer& aContainer,IAlfMap* aData,bool aImmediate); |
|
256 |
|
257 void setTactileFeedback(CAlfVisual &aVisual,AlfAttributeContainer& aContainer,IAlfMap* aData); |
|
258 |
|
259 private: // data |
|
260 }; |
|
261 |
|
262 } // namespace Alf |
|
263 |
|
264 #endif // ALFCOMMONVISUALATTRIBUTESETTER_H |
|
265 |