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: Text visual attribute setter Header. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef ALFTEXTVISUALATTRIBUTESETTER_H |
|
20 #define ALFTEXTVISUALATTRIBUTESETTER_H |
|
21 |
|
22 //includes |
|
23 |
|
24 //widget model includes |
|
25 #include "alf/alfcommonvisualattributesetter.h" |
|
26 |
|
27 //osn includes |
|
28 #include <osn/osndefines.h> |
|
29 |
|
30 namespace Alf |
|
31 { |
|
32 |
|
33 /** |
|
34 * @class AlfTextVisualAttributeSetter alftextvisualattributesetter.h "alf/alftextvisualattributesetter.h" |
|
35 * The implementation of the attribute setter for setting text visual attributes. |
|
36 * @see IAlfAttributeSetter |
|
37 * |
|
38 * @lib alfwidgetmodel.lib |
|
39 * @since S60 ?S60_version |
|
40 * @status Draft |
|
41 * @interfaces IAlfAttributeSetter |
|
42 */ |
|
43 class AlfTextVisualAttributeSetter : public AlfCommonVisualAttributeSetter |
|
44 { |
|
45 |
|
46 public: |
|
47 |
|
48 /** |
|
49 * Constructor. |
|
50 * @exception osncore::AlfVisualException Thrown with error code osncore::EInvalidVisual if aVisual is not |
|
51 * a text visual. |
|
52 * @exception osncore::AlfDataException Thrown with error code osncore::EInvalidAttribute if the data field |
|
53 * for data attributes is 0. |
|
54 * @exception osncore::AlfDataException Thrown with error code osncore::EInvalidVariantDataType if aData |
|
55 * for data attributes is 0. |
|
56 * @exception osncore::AlfDataException Thrown with error code osncore::ECommonError if setting of text color |
|
57 * from skin fails. |
|
58 * @exception osncore::AlfAttributeException Thrown with error code osncore::EInvalidAttribute if there are |
|
59 * invalid number or type of attributes while attempting to set text color. |
|
60 * See language specification on how to create these attributes. |
|
61 * @exception osncore::AlfDataException Thrown with error code osncore::ECommonError if setting text to the |
|
62 * text visual fails. |
|
63 * @exception osncore::AlfDataException Thrown with error code osncore::EInvalidVariantDataType if aData |
|
64 * for data attributes is 0. |
|
65 * |
|
66 * @param aType Type of the attribute setter. |
|
67 */ |
|
68 OSN_IMPORT AlfTextVisualAttributeSetter(); |
|
69 |
|
70 /** |
|
71 * Destructor. |
|
72 */ |
|
73 OSN_IMPORT virtual ~AlfTextVisualAttributeSetter(); |
|
74 |
|
75 /** |
|
76 * Sets the attribute values to the target visual. |
|
77 * |
|
78 * @since S60 ?S60_version |
|
79 * @param aVisual The target visual. Doesn't take ownership |
|
80 * @param aContainer The container holding the value of the attributes. |
|
81 * Ownership of the object is not transferred. |
|
82 * @param aData Used with data attributes to fetch the data. |
|
83 */ |
|
84 OSN_IMPORT virtual void setAttributeValue ( |
|
85 CAlfVisual &aVisual, |
|
86 AlfAttributeContainer* aContainer, |
|
87 IAlfMap* aData ); |
|
88 |
|
89 /** |
|
90 * Depracated! Do not use! |
|
91 * Creates a command to change the value of an attribute in the target visual gradually with a transition. |
|
92 * |
|
93 * @param aVisual The target visual. Doesn't take ownership |
|
94 * @param aContainer The container holding the new value of the attribute. Ownership of the object is not transferred. |
|
95 * @param aData Not used currently. |
|
96 * @param aTransitionTime Time used for the transition. |
|
97 * @param aRefVisual Optional reference visual. If not NULL, the target value of the attribute is defined by adding |
|
98 * the value specific by aContainer to the corresponding attribute value in the reference visual. |
|
99 * @ret The command to gradually change the attribute in the target visual. |
|
100 */ |
|
101 OSN_IMPORT virtual TAlfCommand* createCommand ( |
|
102 CAlfVisual& aVisual, |
|
103 AlfAttributeContainer* aContainer, |
|
104 IAlfMap* aData, |
|
105 int aTransitionTime = 0, |
|
106 CAlfVisual* aRefVisual = NULL ); |
|
107 |
|
108 /** |
|
109 * Creates commands to change the given attribute values in the target visual gradually with a transition. |
|
110 * Then sends the commands via the ALF environment. |
|
111 * |
|
112 * @param aVisual The target visual. Doesn't take ownership |
|
113 * @param aContainer The attribute container holding the attribute value(s) |
|
114 * used by the attribute setter. Ownership is not transferred. The container |
|
115 * can hold new values for multiple different attributes, in which case several |
|
116 * commands are executed. |
|
117 * @param aRefVisual Optional reference visual. If not NULL, the target value of the attribute is defined by adding |
|
118 * the value specific by aContainer to the corresponding attribute value in the reference visual. |
|
119 */ |
|
120 OSN_IMPORT virtual void createAndSendCommands ( |
|
121 CAlfVisual& aVisual, |
|
122 AlfAttributeContainer* aContainer, |
|
123 CAlfVisual* aRefVisual = NULL ); |
|
124 protected: |
|
125 |
|
126 /** |
|
127 * From CAlfCommonVisualAttributeSetter |
|
128 * Sets an value of a static attribute to target visual immediately without a transition. |
|
129 * |
|
130 * @param aVisual The target visual. Doesn't take ownership |
|
131 * @param aAttr The attribute to process. Doesn't take ownership |
|
132 * @param aContainer The container holding attributes. Ownership of the object is not transferred. |
|
133 * @param aData Contains data.Ownership of the object is not transferred. |
|
134 */ |
|
135 virtual void handleStaticAttribute ( CAlfVisual &aVisual, AlfAttribute& aAttr, AlfAttributeContainer& aContainer); |
|
136 |
|
137 /** |
|
138 * From CAlfCommonVisualAttributeSetter |
|
139 * Sets an dynamic attribute value in the target visual using transitions defined in attributes |
|
140 * |
|
141 * @param aVisual The target visual. Doesn't take ownership |
|
142 * @param aAttr The attribute to process. Doesn't take ownership |
|
143 * @param aContainer The container holding attributes. Ownership of the object is not transferred. |
|
144 */ |
|
145 virtual void handleDynamicAttribute ( CAlfVisual &aVisual, AlfAttribute& aAttr, AlfAttributeContainer& aContainer); |
|
146 |
|
147 /** |
|
148 * From CAlfCommonVisualAttributeSetter |
|
149 * Sets an value for static attribute in the target visual immediately without a transition using data in map. |
|
150 * |
|
151 * @param aVisual The target visual. Doesn't take ownership |
|
152 * @param aAttr The attribute to process. Doesn't take ownership |
|
153 * @param aContainer The container holding attributes. Ownership of the object is not transferred. |
|
154 * @param aData Contains data.Ownership of the object is not transferred. |
|
155 */ |
|
156 virtual void handleStaticDataAttribute ( CAlfVisual &aVisual, AlfAttribute& aAttr, AlfAttributeContainer& aContainer, IAlfMap* aData ); |
|
157 |
|
158 /** |
|
159 * From CAlfCommonVisualAttributeSetter |
|
160 * Sets an value for dynamic attribute value in the target visual using transitions and data in map. |
|
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 * @param aData Contains data.Ownership of the object is not transferred. |
|
166 */ |
|
167 virtual void handleDynamicDataAttribute ( CAlfVisual &aVisual, AlfAttribute& aAttr, AlfAttributeContainer& aContainer, IAlfMap* aData ); |
|
168 |
|
169 private: // data |
|
170 |
|
171 /** |
|
172 * Localisation attribute setter helper method. Helper Method. |
|
173 * |
|
174 * @aLocId localisationid defined in .loc files. |
|
175 * @aLang Required language for the text. |
|
176 * |
|
177 */ |
|
178 |
|
179 void setLocalisedText(CAlfVisual& aVisual,const char* aLocId,AlfAttribute* aLangAttr,AlfAttribute* aVarArgsAttr); |
|
180 |
|
181 /** |
|
182 * Helper method to set Text Visual color. |
|
183 * |
|
184 * @aTextVisual TextVisual to which Color has to be set. |
|
185 * @aColorTable Logicalname for colortable. |
|
186 * @aColorIndex Color Index for the colortable. |
|
187 * |
|
188 * @exception osncore::ThemeException Thrown when skinID is not found. |
|
189 * |
|
190 */ |
|
191 void setTextSkinColor(CAlfTextVisual& aTextVisual, const Utf8* aColorTable, |
|
192 const char* aColorIndex=NULL); |
|
193 |
|
194 }; |
|
195 |
|
196 } // namespace Alf |
|
197 |
|
198 #endif // ALFIMAGEVISUALATTRIBUTESETTER_H |
|
199 // End of file |
|
200 |
|
201 |
|