Clutter Reference Manual | ||||
---|---|---|---|---|
Top | Description | Object Hierarchy | Properties |
enum ClutterBinAlignment; struct ClutterBinLayout; struct ClutterBinLayoutClass; ClutterLayoutManager * clutter_bin_layout_new (ClutterBinAlignment x_align
,ClutterBinAlignment y_align
); void clutter_bin_layout_set_alignment (ClutterBinLayout *self
,ClutterActor *child
,ClutterBinAlignment x_align
,ClutterBinAlignment y_align
); void clutter_bin_layout_get_alignment (ClutterBinLayout *self
,ClutterActor *child
,ClutterBinAlignment *x_align
,ClutterBinAlignment *y_align
); void clutter_bin_layout_add (ClutterBinLayout *self
,ClutterActor *child
,ClutterBinAlignment x_align
,ClutterBinAlignment y_align
);
"x-align" ClutterBinAlignment : Read / Write "y-align" ClutterBinAlignment : Read / Write
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
typedef enum { CLUTTER_BIN_ALIGNMENT_FIXED, CLUTTER_BIN_ALIGNMENT_FILL, CLUTTER_BIN_ALIGNMENT_START, CLUTTER_BIN_ALIGNMENT_END, CLUTTER_BIN_ALIGNMENT_CENTER } ClutterBinAlignment;
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
ClutterLayoutManager * clutter_bin_layout_new (ClutterBinAlignment x_align
,ClutterBinAlignment y_align
);
Creates a new ClutterBinLayout layout manager
|
the default alignment policy to be used on the horizontal axis |
|
the default alignment policy to be used on the vertical axis |
Returns : |
the newly created layout manager |
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
|
a ClutterBinLayout |
|
a child of container . [allow-none]
|
|
the horizontal alignment policy to be used for the child
inside container
|
|
the vertical aligment policy to be used on the child
inside container
|
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
|
a ClutterBinLayout |
|
a child of container . [allow-none]
|
|
return location for the horizontal alignment policy. [out][allow-none] |
|
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
|
a ClutterBinLayout |
|
a ClutterActor |
|
horizontal alignment policy for child
|
|
vertical alignment policy for child
|
Since 1.2
"x-align"
property"x-align" ClutterBinAlignment : Read / Write
The default horizontal alignment policy for actors managed by the ClutterBinLayout
Default value: CLUTTER_BIN_ALIGNMENT_CENTER
Since 1.2
"y-align"
property"y-align" ClutterBinAlignment : Read / Write
The default vertical alignment policy for actors managed by the ClutterBinLayout
Default value: CLUTTER_BIN_ALIGNMENT_CENTER
Since 1.2