efl.evas.Box Class

class efl.evas.Box(Canvas canvas, **kwargs)

Bases: efl.evas.Object

A box is a convenience smart object that packs children inside it in sequence, using a layouting function specified by the user.

There are a couple of pre-made layouting functions built-in in Evas, all of them using children size hints to define their size and alignment inside their cell space.

Parameters
  • canvas (Canvas) – The evas canvas for this object

  • **kwargs – All the remaining keyword arguments are interpreted as properties of the instance

align

Alignment of the whole bounding box of contents

Type

(double h, double v)

This will influence how a box object is to align its bounding box of contents within its own area. The values must be in the range 0.0 - 1.0, or undefined behavior is expected. For horizontal alignment, 0.0 means to the left, with 1.0 meaning to the right. For vertical alignment, 0.0 means to the top, with 1.0 meaning to the bottom.

Note

The default values for both alignments is 0.5.

align_get()
align_set(horizontal, vertical)
append(child)

Append a new child object to the box object.

Parameters

child – A child Evas object to be made a member of this object

Returns

A box option bound to the recently added box item or None, on errors

On success, the "child,added" smart event will take place.

Note

The actual placing of the item relative to objects area will depend on the layout set to it. For example, on horizontal layouts an item in the end of the box’s list of children will appear on its right.

Note

This call will trigger the box’s _Evas_Object_Box_Api::append smart function.

insert_after(child, reference)

Insert a new child object after another existing one, in this box object.

Parameters
  • child – A child Evas object to be made a member of this object

  • reference – The child object to place this new one after

Returns

A box option bound to the recently added box item or None, on errors

On success, the "child,added" smart event will take place.

Note

This function will fail if reference is not a member of this object.

Note

The actual placing of the item relative to this objects area will depend on the layout set to it.

Note

This call will trigger the box’s _Evas_Object_Box_Api::insert_after smart function.

insert_at(child, pos)

Insert a new child object at a given position, in this box object.

Parameters
  • child – A child Evas object to be made a member of this object

  • pos – The numeric position (starting from 0) to place the new child object at

Returns

A box option bound to the recently added box item or None, on errors

On success, the "child,added" smart event will take place.

Note

This function will fail if the given position is invalid, given this objects internal list of elements.

Note

The actual placing of the item relative to this objects area will depend on the layout set to it.

Note

This call will trigger the box’s _Evas_Object_Box_Api::insert_at smart function.

insert_before(child, reference)

Insert a new child object before another existing one, in a given box object.

Parameters
  • child – A child Evas object to be made a member of this object

  • reference – The child object to place this new one before

Returns

A box option bound to the recently added box item or None, on errors

On success, the "child,added" smart event will take place.

Note

This function will fail if reference is not a member of this object.

Note

The actual placing of the item relative to o’s area will depend on the layout set to it.

Note

This call will trigger the box’s _Evas_Object_Box_Api::insert_before smart function.

padding

Set the (space) padding between cells set for a given box object.

Type

(int h, int v)

Note

The default values for both padding components is 0.

padding_get()
padding_set(horizontal, vertical)
prepend(child)

Prepend a new child object to the box object.

Parameters

child – A child Evas object to be made a member of this object

Returns

A box option bound to the recently added box item or None, on errors

On success, the "child,added" smart event will take place.

Note

The actual placing of the item relative to objects area will depend on the layout set to it. For example, on horizontal layouts an item in the beginning of the box’s list of children will appear on its left.

Note

This call will trigger the box’s _Evas_Object_Box_Api::prepend smart function.

remove(child)

Remove a given object from a box object, unparenting it again.

Parameters

child – The handle to the child object to be removed

Returns

True, on success, False otherwise

On removal, you’ll get an unparented object again, just as it was before you inserted it in the box. The _Evas_Object_Box_Api::option_free box smart callback will be called automatically for you and, also, the "child,removed" smart event will take place.

Note

This call will trigger the box’s _Evas_Object_Box_Api::remove smart function.

remove_all(clear)

Remove all child objects from a box object, unparenting them again.

Parameters

clear – if true, it will delete just removed children.

Returns

True, on success, False otherwise

This has the same effect of calling evas_object_box_remove() on each of o’s child objects, in sequence. If, and only if, all those calls succeed, so does this one.

remove_at(pos)

Remove an object, bound to a given position in a box object, unparenting it again.

Parameters

pos – The numeric position (starting from 0) of the child object to be removed

Returns

True, on success, False otherwise

On removal, you’ll get an unparented object again, just as it was before you inserted it in the box. The option_free box smart callback will be called automatically for you and, also, the "child,removed" smart event will take place.

Note

This function will fail if the given position is invalid, given o’s internal list of elements.

Note

This call will trigger the box’s _Evas_Object_Box_Api::remove_at smart function.