Top | ![]() |
![]() |
![]() |
![]() |
ClutterLayoutManager * | clutter_bin_layout_new () |
void | clutter_bin_layout_set_alignment () |
void | clutter_bin_layout_get_alignment () |
void | clutter_bin_layout_add () |
ClutterBinLayout is a layout manager which implements the following policy:
Figure 4. Bin layout
The image shows a ClutterBinLayout with three layers:
a background ClutterCairoTexture, set to fill on both the X
and Y axis; a ClutterTexture, set to center on both the X and
Y axis; and a ClutterRectangle, set to CLUTTER_BIN_ALIGNMENT_END
on both the X and Y axis.
Example 5. How to pack actors inside a BinLayout
The following code shows how to build a composite actor with a texture and a background, and add controls overlayed on top. The background is set to fill the whole allocation, whilst the texture is centered; there is a control in the top right corner and a label in the bottom, filling out the whole allocated width.
ClutterLayoutManager *manager; ClutterActor *box; /* create the layout first */ layout = clutter_bin_layout_new (CLUTTER_BIN_ALIGNMENT_CENTER, CLUTTER_BIN_ALIGNMENT_CENTER); box = clutter_box_new (layout); /* then the container */ /* we can use the layout object to add actors */ clutter_bin_layout_add (CLUTTER_BIN_LAYOUT (layout), background, CLUTTER_BIN_ALIGNMENT_FILL, CLUTTER_BIN_ALIGNMENT_FILL); clutter_bin_layout_add (CLUTTER_BIN_LAYOUT (layout), icon, CLUTTER_BIN_ALIGNMENT_CENTER, CLUTTER_BIN_ALIGNMENT_CENTER); /* align to the bottom left */ clutter_bin_layout_add (CLUTTER_BIN_LAYOUT (layout), label, CLUTTER_BIN_ALIGNMENT_START, CLUTTER_BIN_ALIGNMENT_END); /* align to the top right */ clutter_bin_layout_add (CLUTTER_BIN_LAYOUT (layout), button, CLUTTER_BIN_ALIGNMENT_END, CLUTTER_BIN_ALIGNMENT_START);
ClutterBinLayout is available since Clutter 1.2
ClutterLayoutManager * clutter_bin_layout_new (ClutterBinAlignment x_align
,ClutterBinAlignment y_align
);
Creates a new ClutterBinLayout layout manager
x_align |
the default alignment policy to be used on the horizontal axis |
|
y_align |
the default alignment policy to be used on the vertical axis |
Since 1.2
void clutter_bin_layout_set_alignment (ClutterBinLayout *self
,ClutterActor *child
,ClutterBinAlignment x_align
,ClutterBinAlignment y_align
);
Sets the horizontal and vertical alignment policies to be applied
to a child
of self
If child
is NULL
then the x_align
and y_align
values will
be set as the default alignment policies
self |
||
child |
a child of |
[allow-none] |
x_align |
the horizontal alignment policy to be used for the |
|
y_align |
the vertical aligment policy to be used on the |
Since 1.2
void clutter_bin_layout_get_alignment (ClutterBinLayout *self
,ClutterActor *child
,ClutterBinAlignment *x_align
,ClutterBinAlignment *y_align
);
Retrieves the horizontal and vertical alignment policies for
a child of self
If child
is NULL
the default alignment policies will be returned
instead
self |
||
child |
a child of |
[allow-none] |
x_align |
return location for the horizontal alignment policy. |
[out][allow-none] |
y_align |
return location for the vertical alignment policy. |
[out][allow-none] |
Since 1.2
void clutter_bin_layout_add (ClutterBinLayout *self
,ClutterActor *child
,ClutterBinAlignment x_align
,ClutterBinAlignment y_align
);
Adds a ClutterActor to the container using self
and
sets the alignment policies for it
This function is equivalent to clutter_container_add_actor()
and clutter_layout_manager_child_set_property()
but it does not
require a pointer to the ClutterContainer associated to the
ClutterBinLayout
self |
||
child |
||
x_align |
horizontal alignment policy for |
|
y_align |
vertical alignment policy for |
Since 1.2
The alignment policies available on each axis for ClutterBinLayout
Fixed position alignment; the ClutterBinLayout will honour the fixed position provided by the actors themselves when allocating them |
||
Fill the allocation size |
||
Position the actors at the top or left side of the container, depending on the axis |
||
Position the actors at the bottom or right side of the container, depending on the axis |
||
Position the actors at the center of the container, depending on the axis |
Since 1.2
struct ClutterBinLayout;
The ClutterBinLayout structure contains only private data and should be accessed using the provided API
Since 1.2
struct ClutterBinLayoutClass { };
The ClutterBinLayoutClass structure contains only private data and should be accessed using the provided API
Since 1.2
“x-align”
property“x-align” ClutterBinAlignment
The default horizontal alignment policy for actors managed by the ClutterBinLayout
Flags: Read / Write
Default value: CLUTTER_BIN_ALIGNMENT_CENTER
Since 1.2
“y-align”
property“y-align” ClutterBinAlignment
The default vertical alignment policy for actors managed by the ClutterBinLayout
Flags: Read / Write
Default value: CLUTTER_BIN_ALIGNMENT_CENTER
Since 1.2