|
1 /* |
|
2 * Copyright (c) 2006 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: Anchor layout definition. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef C_ALFANCHORLAYOUT_H |
|
21 #define C_ALFANCHORLAYOUT_H |
|
22 |
|
23 #include <alf/alflayout.h> |
|
24 |
|
25 /** for internal use only */ |
|
26 enum TAlfAnchorBitmask |
|
27 { |
|
28 EAlfAnchorBitmaskHorizontal = 0x000F, |
|
29 EAlfAnchorBitmaskVertical = 0x00F0 |
|
30 }; |
|
31 |
|
32 /** for internal use only */ |
|
33 enum TAlfAnchorBitmaskShift |
|
34 { |
|
35 EAlfAnchorBitmaskShiftHorizontal = 0, |
|
36 EAlfAnchorBitmaskShiftVertical = 4 |
|
37 }; |
|
38 |
|
39 /** for internal use only */ |
|
40 enum TAlfAnchorAxis |
|
41 { |
|
42 EAlfAnchorAxisHorizontal = 0, |
|
43 EAlfAnchorAxisVertical = 1 |
|
44 }; |
|
45 |
|
46 /** for internal use only */ |
|
47 enum TAlfAnchorProximity |
|
48 { |
|
49 EAlfAnchorProximityNone = 0, |
|
50 EAlfAnchorProximitySize, |
|
51 EAlfAnchorProximityNear, |
|
52 EAlfAnchorProximityCenter, |
|
53 EAlfAnchorProximityFar |
|
54 }; |
|
55 |
|
56 /** |
|
57 * Anchor type. Used to determine which edge or corner of a child visual is |
|
58 * defined by an anchor. |
|
59 * |
|
60 * @note that if width or height are used as one anchor, they must be combined |
|
61 * with an appropriate anchor in order to unambiguously determine the size and |
|
62 * position of the child. |
|
63 */ |
|
64 enum TAlfAnchorType |
|
65 { |
|
66 EAlfAnchorTypeNone = EAlfAnchorProximityNone, |
|
67 |
|
68 EAlfAnchorTypeWidth = EAlfAnchorProximitySize << EAlfAnchorBitmaskShiftHorizontal, |
|
69 EAlfAnchorTypeLeft = EAlfAnchorProximityNear << EAlfAnchorBitmaskShiftHorizontal, |
|
70 EAlfAnchorTypeHCenter = EAlfAnchorProximityCenter << EAlfAnchorBitmaskShiftHorizontal, |
|
71 EAlfAnchorTypeRight = EAlfAnchorProximityFar << EAlfAnchorBitmaskShiftHorizontal, |
|
72 |
|
73 EAlfAnchorTypeHeight = EAlfAnchorProximitySize << EAlfAnchorBitmaskShiftVertical, |
|
74 EAlfAnchorTypeTop = EAlfAnchorProximityNear << EAlfAnchorBitmaskShiftVertical, |
|
75 EAlfAnchorTypeVCenter = EAlfAnchorProximityCenter << EAlfAnchorBitmaskShiftVertical, |
|
76 EAlfAnchorTypeBottom = EAlfAnchorProximityFar << EAlfAnchorBitmaskShiftVertical, |
|
77 |
|
78 |
|
79 EAlfAnchorTypeSize = EAlfAnchorTypeHeight | EAlfAnchorTypeWidth, |
|
80 |
|
81 EAlfAnchorTypeTopLeft = EAlfAnchorTypeTop | EAlfAnchorTypeLeft, |
|
82 EAlfAnchorTypeTopCenter = EAlfAnchorTypeTop | EAlfAnchorTypeHCenter, |
|
83 EAlfAnchorTypeTopRight = EAlfAnchorTypeTop | EAlfAnchorTypeRight, |
|
84 |
|
85 EAlfAnchorTypeCenterLeft = EAlfAnchorTypeVCenter | EAlfAnchorTypeLeft, |
|
86 EAlfAnchorTypeCenter = EAlfAnchorTypeVCenter | EAlfAnchorTypeHCenter, |
|
87 EAlfAnchorTypeCenterRight = EAlfAnchorTypeVCenter | EAlfAnchorTypeRight, |
|
88 |
|
89 EAlfAnchorTypeBottomLeft = EAlfAnchorTypeBottom | EAlfAnchorTypeLeft, |
|
90 EAlfAnchorTypeBottomCenter = EAlfAnchorTypeBottom | EAlfAnchorTypeHCenter, |
|
91 EAlfAnchorTypeBottomRight = EAlfAnchorTypeBottom | EAlfAnchorTypeRight |
|
92 }; |
|
93 |
|
94 /** |
|
95 * Anchor origin, relative to a particular edge or corner. Direction is |
|
96 * measured along positive x and y axes, as modified by the metric used. |
|
97 */ |
|
98 enum TAlfAnchorAttachmentOrigin |
|
99 { |
|
100 EAlfAnchorAttachmentOriginNone = EAlfAnchorTypeNone, |
|
101 |
|
102 EAlfAnchorAttachmentOriginLeft = EAlfAnchorTypeLeft, |
|
103 EAlfAnchorAttachmentOriginHCenter = EAlfAnchorTypeHCenter, |
|
104 EAlfAnchorAttachmentOriginRight = EAlfAnchorTypeRight, |
|
105 |
|
106 EAlfAnchorAttachmentOriginTop = EAlfAnchorTypeTop, |
|
107 EAlfAnchorAttachmentOriginVCenter = EAlfAnchorTypeVCenter, |
|
108 EAlfAnchorAttachmentOriginBottom = EAlfAnchorTypeBottom, |
|
109 |
|
110 EAlfAnchorAttachmentOriginTopLeft = EAlfAnchorTypeTopLeft, |
|
111 EAlfAnchorAttachmentOriginTopCenter = EAlfAnchorTypeTopCenter, |
|
112 EAlfAnchorAttachmentOriginTopRight = EAlfAnchorTypeTopRight, |
|
113 |
|
114 EAlfAnchorAttachmentOriginCenterLeft = EAlfAnchorTypeCenterLeft, |
|
115 EAlfAnchorAttachmentOriginCenter = EAlfAnchorTypeCenter, |
|
116 EAlfAnchorAttachmentOriginCenterRight = EAlfAnchorTypeCenterRight, |
|
117 |
|
118 EAlfAnchorAttachmentOriginBottomLeft = EAlfAnchorTypeBottomLeft, |
|
119 EAlfAnchorAttachmentOriginBottomCenter = EAlfAnchorTypeBottomCenter, |
|
120 EAlfAnchorAttachmentOriginBottomRight = EAlfAnchorTypeBottomRight |
|
121 }; |
|
122 |
|
123 /** |
|
124 * Type of attachment point used when attaching an anchor to another |
|
125 * anchor in the same layout. |
|
126 */ |
|
127 enum TAlfAnchorAttachmentType |
|
128 { |
|
129 EAlfAnchorAttachToParent = -1 |
|
130 }; |
|
131 |
|
132 |
|
133 /** |
|
134 * Determines which corner of a child visual is positioned by the anchor |
|
135 * @deprecated, only retained for use with deprecated SetAnchor routines, use |
|
136 * TAlfAnchorAttachmentOrigin instead with new APIs |
|
137 */ |
|
138 enum TAlfAnchor |
|
139 { |
|
140 /** Anchor that defines the top left corner of a visual. */ |
|
141 EAlfAnchorTopLeft, |
|
142 |
|
143 /** Anchor that defines the bottom right corner of a visual. */ |
|
144 EAlfAnchorBottomRight |
|
145 }; |
|
146 |
|
147 /** |
|
148 * Anchor origins. |
|
149 * @deprecated, only retained for use with deprecated SetAnchor routines, use |
|
150 * TAlfAnchorAttachmentOrigin instead with new APIs |
|
151 */ |
|
152 enum TAlfAnchorOrigin |
|
153 { |
|
154 EAlfAnchorOriginLeft, |
|
155 EAlfAnchorOriginHCenter, |
|
156 EAlfAnchorOriginRight, |
|
157 EAlfAnchorOriginTop, |
|
158 EAlfAnchorOriginVCenter, |
|
159 EAlfAnchorOriginBottom |
|
160 }; |
|
161 |
|
162 |
|
163 /** |
|
164 *Anchor metric types, for offsets and sizes. |
|
165 * @deprecated, only retained for use with deprecated SetAnchor routines, use |
|
166 * TAlfMetric instead with new APIs |
|
167 */ |
|
168 enum TAlfAnchorMetric |
|
169 { |
|
170 /** Use absolute pixel coordinates to specify the values. */ |
|
171 EAlfAnchorMetricAbsolute, |
|
172 /** |
|
173 * Use the size of the visual |
|
174 * either normalized between 0.0 (at origin) and 1.0 (farthest away edge) |
|
175 * or -0.5 (min) and +0.5 (0.0 being always at the origin). For example if you |
|
176 * use EAlfAnchorOriginLeft with EAlfAnchorMetricRelativeToSize, the |
|
177 * left edge is at 0.0, and the right edge at 1.0. But if you use any of |
|
178 * the center origins (EAlfAnchorOriginHCenter or EAlfAnchorOriginVCenter), |
|
179 * then the left/top edge is at -0.5 and right/top edge is at +0.5. |
|
180 */ |
|
181 EAlfAnchorMetricRelativeToSize |
|
182 }; |
|
183 |
|
184 class TAlfTimedPoint; |
|
185 class CAlfControl; |
|
186 |
|
187 /** |
|
188 * CAlfAnchorLayout is a layout that allows visuals to be positioned with |
|
189 * flexible relative anchor points. |
|
190 * |
|
191 * To use this class, an anchor layout is created, and then a number of anchors |
|
192 * are added to it using calls to the Attach() methods. The visuals |
|
193 * inside the layout will be stretched between these anchor points. |
|
194 * |
|
195 * @lib alfclient.lib |
|
196 * @since S60 v3.2 |
|
197 */ |
|
198 class CAlfAnchorLayout : public CAlfLayout |
|
199 { |
|
200 |
|
201 public: |
|
202 |
|
203 /** |
|
204 * Two-phased constructor, which attach new object into the control. |
|
205 * @param aOwnerControl Control that owns this new obejct. |
|
206 * @param aParentLayout If given, the new object is set as child. |
|
207 */ |
|
208 IMPORT_C static CAlfAnchorLayout* AddNewL(CAlfControl& aOwnerControl, |
|
209 CAlfLayout* aParentLayout = 0); |
|
210 |
|
211 /** |
|
212 * Constructor. |
|
213 */ |
|
214 IMPORT_C CAlfAnchorLayout(); |
|
215 |
|
216 /** |
|
217 * From CAlfLayout. Second-phase constructor. |
|
218 */ |
|
219 IMPORT_C void ConstructL(CAlfControl& aOwner); |
|
220 |
|
221 /** |
|
222 * Virtual destructor. |
|
223 */ |
|
224 IMPORT_C ~CAlfAnchorLayout(); |
|
225 |
|
226 /** |
|
227 * Resets all the anchors. |
|
228 */ |
|
229 IMPORT_C void Reset(); |
|
230 |
|
231 /** |
|
232 * Anchors a child visual's corner to specific position within this layout. |
|
233 * |
|
234 * @deprecated, use new @c Attach APIs with TAlfMetric support. |
|
235 * See the relevant API documentation for an example of how to migrate your code |
|
236 * |
|
237 * Each child can have two anchors: the top left and bottom right corners |
|
238 * of the child visual. These anchors can be fastened to any point within |
|
239 * this layout, as specified by the other parameters. |
|
240 * |
|
241 * In a typical case you set two anchors (both EAlfAnchorTopLeft and |
|
242 * EAlfAnchorBottomRight), which specifies both size and position for the |
|
243 * child. However it is also possible to set only the EAlfAnchorTopLeft |
|
244 * anchor, which only positions the child without affecting it's size. |
|
245 * |
|
246 * @see RemoveAnchor() to remove an achor definition. |
|
247 * |
|
248 * @note After updating anchors, you should call |
|
249 * CAlfLayout::UpdateChildrenLayout(), to cause the anchors to be |
|
250 * applied to child positions and/or sizes. |
|
251 * |
|
252 * For example the following code will anchor child visual number 0 in |
|
253 * the middle of the layout, with a 25% border around the outside: |
|
254 * |
|
255 * \code |
|
256 * // set top left corner position of 1st child .. |
|
257 * iLayout->SetAnchor(EAlfAnchorTopLeft, 0, |
|
258 * EAlfAnchorOriginLeft, |
|
259 * EAlfAnchorOriginTop, |
|
260 * EAlfAnchorMetricRelativeToSize, // With EAlfAnchorOriginLeft means that 0.0 goes to left edge, and 1.0 to the right |
|
261 * EAlfAnchorMetricRelativeToSize, // With EAlfAnchorOriginTop means that 0.0 goes to top edge, and 1.0 to the bottom |
|
262 * TAlfTimedPoint(0.25, 0.25)); |
|
263 * // .. and set the bottom right corner also to fix the size |
|
264 * iLayout->SetAnchor(EAlfAnchorBottomRight, 0, |
|
265 * EAlfAnchorOriginRight, |
|
266 * EAlfAnchorOriginBottom, |
|
267 * EAlfAnchorMetricRelativeToSize, |
|
268 * EAlfAnchorMetricRelativeToSize, |
|
269 * TAlfTimedPoint(-0.25, -0.25)); |
|
270 * \endcode |
|
271 * |
|
272 * @todo Specifying a transition in the timed point may be useless: |
|
273 * layouts are evaluated pretty seldom. |
|
274 * |
|
275 * @param aAnchor Type of the anchor (either EAlfAnchorTopLeft for the |
|
276 * top left corner or EAlfAnchorBottomRight for bottom right |
|
277 * corner). |
|
278 * @param aOrdinal Ordinal of the child visual that this anchor applies to. |
|
279 * @param aHorizOrigin Horizontal origin for the anchor position (aPosition). |
|
280 * Defines the point inside the layout on which the |
|
281 * evaluation of the child's placement is based. May be |
|
282 * EAlfAnchorOriginLeft (left edge), |
|
283 * EAlfAnchorOriginHCenter (center) or |
|
284 * EAlfAnchorOriginRight (right edge). |
|
285 * @param aVertOrigin Vertical origin for the anchor position (aPosition). |
|
286 * Defines the point inside the layout on which the |
|
287 * evaluation of the child's placement is based. Possible options |
|
288 * are EAlfAnchorOriginTop (top), EAlfAnchorOriginVCenter |
|
289 * (center) and EAlfAnchorOriginBottom (bottom). |
|
290 * @param aHorizMetric Specifies the metric to use to define the |
|
291 * horizontal position: EAlfAnchorMetricAbsolute to use |
|
292 * absolute pixels or EAlfAnchorMetricRelativeToSize to |
|
293 * use normalized values relative to layout size. |
|
294 * @param aVertMetric Specifies the metric used in the vertical position: |
|
295 * EAlfAnchorMetricAbsolute to use absolute pixels or |
|
296 * EAlfAnchorMetricRelativeToSize to use normalized |
|
297 * values relative to layout size. |
|
298 * @param aPosition The achor position as an offset from the origin point, |
|
299 * applied using the metric specified with aHorizMetric |
|
300 * and aVertMetric. |
|
301 * @return Error code |
|
302 * |
|
303 */ |
|
304 IMPORT_C TInt SetAnchor( |
|
305 TAlfAnchor aAnchor, |
|
306 TInt aOrdinal, |
|
307 TAlfAnchorOrigin aHorizOrigin, |
|
308 TAlfAnchorOrigin aVertOrigin, |
|
309 TAlfAnchorMetric aHorizMetric, |
|
310 TAlfAnchorMetric aVertMetric, |
|
311 const TAlfTimedPoint& aOffset); |
|
312 |
|
313 /** |
|
314 * Convenience method for setting top left and bottom right anchors in a single call. |
|
315 * |
|
316 * This method sets size-relative anchors for a single child visual. |
|
317 * |
|
318 * @param aOrdinal Ordinal of child visual to set anchors for. |
|
319 * @param aTlHorizOrigin Horizontal origin for the top left anchor position (aPosition). |
|
320 * Defines the point inside the layout on which the |
|
321 * evaluation of the child's placement is based. May be |
|
322 * EAlfAnchorOriginLeft (left edge), |
|
323 * EAlfAnchorOriginHCenter (center) or |
|
324 * EAlfAnchorOriginRight (right edge). |
|
325 * @param aTlVertOrigin Vertical origin for the top left anchor position (aPosition). |
|
326 * Defines the point inside the layout on which the |
|
327 * evaluation of the child's placement is based. Possible options |
|
328 * are EAlfAnchorOriginTop (top), EAlfAnchorOriginVCenter |
|
329 * (center) and EAlfAnchorOriginBottom (bottom). |
|
330 * @param aTopLeftOffset The achor position as an offset from the origin point, |
|
331 * @param aBrHorizOrigin Horizontal origin for the bottom right anchor position (aPosition). |
|
332 * Defines the point inside the layout on which the |
|
333 * evaluation of the child's placement is based. May be |
|
334 * EAlfAnchorOriginLeft (left edge), |
|
335 * EAlfAnchorOriginHCenter (center) or |
|
336 * EAlfAnchorOriginRight (right edge). |
|
337 * @param aBrVertOrigin Vertical origin for the bottom right anchor position (aPosition). |
|
338 * Defines the point inside the layout on which the |
|
339 * evaluation of the child's placement is based. Possible options |
|
340 * are EAlfAnchorOriginTop (top), EAlfAnchorOriginVCenter |
|
341 * (center) and EAlfAnchorOriginBottom (bottom). |
|
342 * @param aBottomRightOffset The achor position as an offset from the origin point, |
|
343 * @return Error code. |
|
344 * |
|
345 * |
|
346 * @see CAlfAnchorLayout::SetAnchor() for more information about anchors. |
|
347 */ |
|
348 IMPORT_C TInt SetRelativeAnchorRect(TInt aOrdinal, |
|
349 TAlfAnchorOrigin aTlHorizOrigin, |
|
350 TAlfAnchorOrigin aTlVertOrigin, |
|
351 const TAlfRealPoint& aTopLeftOffset, |
|
352 TAlfAnchorOrigin aBrHorizOrigin, |
|
353 TAlfAnchorOrigin aBrVertOrigin, |
|
354 const TAlfRealPoint& aBottomRightOffset); |
|
355 |
|
356 /** |
|
357 * Undefines an anchor. |
|
358 * @see SetAnchor() |
|
359 * @deprecated instead use @c Detach and see relevant API documentation for |
|
360 * example code |
|
361 */ |
|
362 IMPORT_C void RemoveAnchor(TAlfAnchor aAnchor, TInt aOrdinal); |
|
363 |
|
364 /** |
|
365 * Anchors one or more edges of a child visual to a specific position |
|
366 * within this layout. When combined together, a correctly specified group |
|
367 * of anchors provide sufficient information for the anchor layout to |
|
368 * determine the size and position of the child visual. |
|
369 * |
|
370 * Each child can have up to four anchors, each of which correspond to an |
|
371 * edge. A corner anchor is equivalent to supplying two similar orthogonal |
|
372 * edge anchors, so typically it is easier to use corners. Therefore, each |
|
373 * child can have up to two corner anchors, or a mixture of corners and |
|
374 * edges. Alternatively, four similar edges can be specified in one call by |
|
375 * supplying a box metric. |
|
376 * |
|
377 * In a typical case you set two different corner anchors (for example both |
|
378 * EAlfAnchorTypeTopLeft and EAlfAnchorTypeBottomRight), taking care |
|
379 * to ensure that they are sufficiently orthogonal in order to define all needed |
|
380 * coordinates. However it is also possible to set only one corner anchor, |
|
381 * which only positions the child without affecting it's size. Alternatively, |
|
382 * one anchor can be specified as a corner, and then the other can be |
|
383 * specified as EAlfAnchorTypeSize; similarly the coordinates along |
|
384 * one axis can be specified by an appropriate combination of edge and |
|
385 * width or height anchors. |
|
386 * |
|
387 * The position of each anchor relative to this layout is determined |
|
388 * by the choice of origin (i.e. which point of the layout the |
|
389 * child's is attached to), and the offset position, which is specified |
|
390 * using a TAlfMetric or related type. All available features of |
|
391 * TAlfMetric may be used to affect the resulting position, providing the |
|
392 * benefit that different metrics can be used for each child. Also note |
|
393 * that the metric used will override the base unit that has been set in |
|
394 * this layout. |
|
395 * |
|
396 * @note if called again to specify the same anchor types |
|
397 * that have been previous set, those definitions will be updated. |
|
398 * However, in order to change type, it is necessary to detach a |
|
399 * previously defined anchor first, as there can only be a maximum |
|
400 * of two anchors along each axis (for a given child). |
|
401 * @note that size anchor type and attachment origins are not |
|
402 * currenly supported. |
|
403 * @note that center anchor type is not currently supported. |
|
404 * @note if an anchor of similar type has already been defined it will be |
|
405 * replaced, however in general it is easier to manage anchors by |
|
406 * removing them all and starting again. |
|
407 * @note After updating anchors, you should call |
|
408 * @c CAlfLayout::UpdateChildrenLayout(), to cause the anchors to be |
|
409 * applied to child positions and/or sizes. |
|
410 * |
|
411 * @see @c Detach() to remove achor definitions for a given ordinal |
|
412 * |
|
413 * For example the following code will anchor three child visuals 0, 1, 2 in |
|
414 * the middle of the layout, with a 25% border around the outside, such that |
|
415 * they all occupy the same position: |
|
416 * |
|
417 * \code |
|
418 * // using edges... |
|
419 * iLayout->Attach(0, |
|
420 * EAlfAnchorTypeLeft, |
|
421 * TAlfXYMetric(0.25, EAlfMetricNormalized), |
|
422 * EAlfAnchorAttachmentOriginLeft); |
|
423 * iLayout->Attach(0, |
|
424 * EAlfAnchorTypeRight, |
|
425 * TAlfXYMetric(-0.25, EAlfMetricNormalized), |
|
426 * EAlfAnchorAttachmentOriginRight); |
|
427 * iLayout->Attach(0, |
|
428 * EAlfAnchorTypeTop, |
|
429 * TAlfXYMetric(0.25, EAlfMetricNormalized), |
|
430 * EAlfAnchorAttachmentOriginTop); |
|
431 * iLayout->Attach(0, |
|
432 * EAlfAnchorTypeBottom, |
|
433 * TAlfXYMetric(-0.25, EAlfMetricNormalized), |
|
434 * EAlfAnchorAttachmentOriginBottom); |
|
435 * |
|
436 * // using corners... |
|
437 * iLayout->Attach(1, |
|
438 * EAlfAnchorTypeTopLeft, |
|
439 * TAlfXYMetric(0.25, EAlfMetricNormalized), |
|
440 * EAlfAnchorAttachmentOriginTopLeft); |
|
441 * iLayout->Attach(1, |
|
442 * EAlfAnchorTypeBottomRight, |
|
443 * TAlfXYMetric(-0.25, EAlfMetricNormalized), |
|
444 * EAlfAnchorAttachmentOriginBottomRight); |
|
445 * |
|
446 * // .. and using a box |
|
447 * iLayout->Attach(2, TAlfBoxMetric( |
|
448 * TAlfMetric(0.25, EAlfMetricNormalized), |
|
449 * TAlfMetric(-0.25, EAlfMetricNormalized), |
|
450 * TAlfMetric(0.25, EAlfMetricNormalized), |
|
451 * TAlfMetric(-0.25, EAlfMetricNormalized))); |
|
452 * \endcode |
|
453 * |
|
454 * @param aOrdinal Ordinal of the child visual that this anchor applies to |
|
455 * @param aType Type of the anchor, which determines how and where the anchor attaches to this layout |
|
456 * @param aOffset The anchor position as an offset from the origin point, |
|
457 * specifying both the magnitude and units of the offset for the relevant axes. |
|
458 * @param aAttachmentOrigin Origin for the anchor offset. |
|
459 * Defines the point inside the layout from which the |
|
460 * evaluation of the child's placement is based. |
|
461 * @param aAttachmentOrdinal the ordinal of the anchor to which this anchor is attached, |
|
462 * use the default value of EAlfAnchorAttachToParent in order to attach to parent |
|
463 * @return Error code |
|
464 * |
|
465 */ |
|
466 IMPORT_C TInt Attach( |
|
467 TInt aOrdinal, |
|
468 TAlfAnchorType aType, |
|
469 const TAlfMetric& aOffset, |
|
470 TAlfAnchorAttachmentOrigin aAttachmentOrigin, |
|
471 TInt aAttachmentOrdinal = EAlfAnchorAttachToParent); |
|
472 |
|
473 /** |
|
474 * Attach a corner of a child visual to a specific position |
|
475 * within this layout. |
|
476 * |
|
477 * @see Attach() for all API documentation |
|
478 */ |
|
479 IMPORT_C TInt Attach( |
|
480 TInt aOrdinal, |
|
481 TAlfAnchorType aType, |
|
482 const TAlfXYMetric& aOffset, |
|
483 TAlfAnchorAttachmentOrigin aAttachmentOrigin = EAlfAnchorAttachmentOriginTopLeft, |
|
484 TInt aAttachmentOrdinal = EAlfAnchorAttachToParent); |
|
485 |
|
486 /** |
|
487 * Attach all four edges of a child visual to a specific position |
|
488 * within this layout. |
|
489 * |
|
490 * @note, will detach all existing edges first. In case of error, all |
|
491 * edges that were successfull added before the error occurred will be |
|
492 * detached. |
|
493 * |
|
494 * @see Attach() for all API documentation |
|
495 * @param aAttachmentOrigin if set to EAlfAnchorAttachmentOriginNone, each edge will |
|
496 * be attached to the corresponding edge |
|
497 */ |
|
498 IMPORT_C TInt Attach( |
|
499 TInt aOrdinal, |
|
500 const TAlfBoxMetric& aOffset, |
|
501 TAlfAnchorAttachmentOrigin aAttachmentOrigin = EAlfAnchorAttachmentOriginTopLeft, |
|
502 TInt aAttachmentOrdinal = EAlfAnchorAttachToParent); |
|
503 |
|
504 |
|
505 /** |
|
506 * Undefines all anchors for a specified ordinal. Has no effect if the specified ordinal |
|
507 * cannot be found. |
|
508 * |
|
509 * @see Attach() |
|
510 * |
|
511 * @param aOrdinal the ordinal of the anchor to remove |
|
512 */ |
|
513 IMPORT_C void Detach(TInt aOrdinal); |
|
514 |
|
515 /** |
|
516 * Undefines an anchor. Has no effect if the specified anchor type |
|
517 * cannot be found. For example to detach a corner anchor with ordinal |
|
518 * equal to zero: |
|
519 * |
|
520 * \code |
|
521 * iLayout->Detach(0, EAlfAnchorTypeTopLeft); |
|
522 * \endcode |
|
523 * |
|
524 * @see Attach() |
|
525 * @note can be used to separately remove the edges |
|
526 * that were attached using different combinations of types, |
|
527 * but try to be consistent in using either edges or corners to avoid |
|
528 * confusion. |
|
529 * |
|
530 * @param aOrdinal the ordinal of the anchor to remove |
|
531 * @param aType the edge relating to the anchor to remove |
|
532 */ |
|
533 IMPORT_C void Detach(TInt aOrdinal, TAlfAnchorType aType); |
|
534 |
|
535 /** |
|
536 * From CAlfVisual |
|
537 * @see CAlfVisual |
|
538 */ |
|
539 IMPORT_C void RemoveAndDestroyAllD(); |
|
540 IMPORT_C void UpdateChildrenLayout(TInt aTransitionTime = 0); |
|
541 IMPORT_C CAlfVisual* FindTag(const TDesC8& aTag); |
|
542 |
|
543 /** |
|
544 * From CAlfLayout |
|
545 * @see CAlfLayout |
|
546 */ |
|
547 IMPORT_C TAlfXYMetric BaseUnit() const; |
|
548 |
|
549 |
|
550 protected: |
|
551 /** |
|
552 * From CAlfVisual |
|
553 * @see CAlfVisual |
|
554 */ |
|
555 IMPORT_C void DoRemoveAndDestroyAllD(); |
|
556 IMPORT_C void PropertyOwnerExtension(const TUid& aExtensionUid, TAny** aExtensionParams); |
|
557 |
|
558 |
|
559 private: |
|
560 |
|
561 // Private data structure. Owned. |
|
562 struct TAnchorLayoutPrivateData; |
|
563 TAnchorLayoutPrivateData* iAnchorLayoutData; |
|
564 |
|
565 }; |
|
566 |
|
567 |
|
568 |
|
569 #endif // C_ALFANCHORLAYOUT_H |