|
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: Attribute container. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef ALFATTRIBUTECONTAINER_H |
|
20 #define ALFATTRIBUTECONTAINER_H |
|
21 |
|
22 #include <osn/osndefines.h> |
|
23 #include <memory> |
|
24 |
|
25 namespace Alf |
|
26 { |
|
27 |
|
28 class AlfAttribute; |
|
29 class AlfAttributeContainerImpl; |
|
30 |
|
31 /** |
|
32 * @class AlfAttributeContainer alfattributecontainer.h "alf/alfattributecontainer.h" |
|
33 * AlfAttributeContainer is a collection of attributes. It is used to bunch up a set |
|
34 * of attributes. Attribute setters and implementations of the IAlfAttributeOwner interface |
|
35 * can work with attribute containers. |
|
36 * @see IAlfAttributeSetter |
|
37 * @see IAlfAttributeOwner |
|
38 * @see AlfAttribute |
|
39 * |
|
40 * @lib alfwidgetmodel.lib |
|
41 * @since S60 ?S60_version |
|
42 * @status Draft |
|
43 */ |
|
44 class AlfAttributeContainer |
|
45 { |
|
46 public: |
|
47 |
|
48 /** Type enumeration. */ |
|
49 enum Type |
|
50 { |
|
51 EAlfCommonAttributeContainer = 0, |
|
52 |
|
53 EAlfSetFlagAttributeContainer, |
|
54 EAlfClearFlagAttributeContainer, |
|
55 |
|
56 EAlfOpacityAttributeContainer, |
|
57 EAlfXPosAttributeContainer, |
|
58 EAlfYPosAttributeContainer, |
|
59 EAlfWidthAttributeContainer, |
|
60 EAlfHeightAttributeContainer, |
|
61 EAlfDepthOffsetAttributeContainer, |
|
62 EAlfScrollAttributeContainer, //not used yet |
|
63 EAlfExpandAttributeContainer, |
|
64 EAlfRowsAttributeContainer, |
|
65 EAlfColumnsAttributeContainer, |
|
66 EAlfAnchorPointAttributeContainer, |
|
67 EAlfScalingAttributeContainer, |
|
68 EAlfImageSecondaryAlphaAttributeContainer, |
|
69 |
|
70 EAlfPositionAttributeContainer, |
|
71 EAlfSizeAttributeContainer, |
|
72 EAlfScrollOffsetAttributeContainer, |
|
73 EAlfTranslationAttributeContainer,//not implemented still |
|
74 EAlfRotationXYZAAttributeContainer,//not implemented still |
|
75 |
|
76 EAlfPrimaryImageAttributeContainer, |
|
77 EAlfSecondaryImageAttributeContainer, |
|
78 EAlfTextAttributeContainer, |
|
79 |
|
80 EAlfViewportSizeAttributeContainer, |
|
81 EAlfViewportVirtualSizeAttributeContainer, |
|
82 EAlfViewportPosAttributeContainer, |
|
83 EAlfSkinImageIDAttributeContainer, |
|
84 EAlfSkinTextColorAttributeContainer, |
|
85 }; |
|
86 |
|
87 /** |
|
88 * Constructor. |
|
89 * @exception std::bad_alloc |
|
90 * |
|
91 * @param aType a type of container. |
|
92 */ |
|
93 OSN_IMPORT AlfAttributeContainer(Type aType = EAlfCommonAttributeContainer); |
|
94 |
|
95 /** |
|
96 * Destructor. |
|
97 */ |
|
98 OSN_IMPORT ~AlfAttributeContainer(); |
|
99 |
|
100 /** |
|
101 * Gets the type of the container. |
|
102 * |
|
103 * @return The type of the container. |
|
104 */ |
|
105 OSN_IMPORT Type type() const; |
|
106 |
|
107 /** |
|
108 * Adds a new attribute to the container. |
|
109 * @exception std::bad_alloc |
|
110 * |
|
111 * @param aAttribute The new attribute, takes ownership. |
|
112 */ |
|
113 OSN_IMPORT void addAttribute( AlfAttribute* aAttribute); |
|
114 |
|
115 /** |
|
116 * Returns the attribute count. |
|
117 * |
|
118 * @return the attribute count. |
|
119 */ |
|
120 OSN_IMPORT unsigned int attributeCount() const; |
|
121 |
|
122 /** |
|
123 * Returns reference to the attribute. |
|
124 * @exception osncore::AlfDataException Thrown with error code osncore::EInvalidAttribute if aIndex is invalid. |
|
125 * |
|
126 * @param aIndex index of the attribute. |
|
127 * @return The attribute. Throws CAlfDataException if index is invalid. |
|
128 * Ownership is not transferred. |
|
129 */ |
|
130 OSN_IMPORT AlfAttribute& getAttribute(unsigned int aIndex) const; |
|
131 |
|
132 /** |
|
133 * Returns the attribute. |
|
134 * @exception osncore::AlfDataException Thrown with error code osncore::EInvalidAttribute if aName is not found among attributes contained in the container. |
|
135 * |
|
136 * @param aName name of the attribute. |
|
137 * @return the attribute. Throws CAlfDataException if attribute is not found. |
|
138 * Ownership is not transferred. |
|
139 */ |
|
140 OSN_IMPORT AlfAttribute& getAttributeByName(const char* aName) const; |
|
141 |
|
142 /** |
|
143 * Removes the attribute. Throws CAlfDataException if index is invalid. |
|
144 * @exception osncore::AlfDataException Thrown with error code osncore::EInvalidAttribute if aIndex is invalid. |
|
145 * |
|
146 * @param aIndex index of the attribute. |
|
147 */ |
|
148 OSN_IMPORT void removeAttribute(unsigned int aIndex); |
|
149 |
|
150 /** |
|
151 * Sets the animation time of the attribute container. |
|
152 * |
|
153 * @param The time value (milliseconds). |
|
154 */ |
|
155 OSN_IMPORT void setTime(unsigned int aTime); |
|
156 |
|
157 /** |
|
158 * Returns the animation time of the attribute container. |
|
159 * |
|
160 * @return The time value (milliseconds). |
|
161 */ |
|
162 OSN_IMPORT unsigned int getTime() const; |
|
163 |
|
164 private: |
|
165 |
|
166 /** |
|
167 * Copy construction, not implemented. |
|
168 */ |
|
169 AlfAttributeContainer(const AlfAttributeContainer&); |
|
170 |
|
171 /** |
|
172 * Assigment operation, not implemented. |
|
173 */ |
|
174 AlfAttributeContainer& operator=(const AlfAttributeContainer&); |
|
175 |
|
176 private: |
|
177 |
|
178 // Implementation data |
|
179 std::auto_ptr<AlfAttributeContainerImpl> mData; |
|
180 }; |
|
181 |
|
182 } // namespace Alf |
|
183 |
|
184 #endif // ALFATTRIBUTECONTAINER_H |