Show / Hide Table of Contents

Class Efl.Ui.Box

A container that arranges children widgets in a vertical or horizontal fashion. The Box widget is the most basic (and the most used) of the container widgets. Other widgets are added to the Box through the Efl.IPackLinear interface, and the layout direction (either vertical or horizontal) is controlled through the Efl.Ui.ILayoutOrientable.Orientation property.

The Box widget itself is invisible, as are most container widgets: Their purpose is to handle the position and size of all their children so you don't have to.

All widgets inside a vertical Box container will have the same width as the container, and their heights will be automatically chosen so that they cover the whole surface of the container from top to bottom (Imagine a stack of pizza boxes neatly fitting inside your oven). The Efl.Ui.Box.Homogeneous property then controls whether all widgets have the same height (homogeneous) or not.

A horizontal Box container example would be the button toolbar at the top of most word processing programs.

Precise layout can be further customized through the Efl.Gfx.IArrangement (object still in beta stage) interface on the Box itself, or through the Efl.Gfx.IHint interface on each of the children widgets.

Inheritance
System.Object
Efl.Eo.EoWrapper
Efl.Object
Efl.LoopConsumer
Efl.Canvas.Object
Efl.Canvas.Group
Efl.Ui.Widget
Efl.Ui.Box
Efl.Ui.BoxFlow
Efl.Ui.BoxStack
Syntax
public class Box : Widget, IPointer, IColor, IEntity, IHint, IMapping, IStack, IInterface, IPart, IPropertyBind, IView, IObject, IPackLayout, IPackLinear, IPack, IContainer, ILayoutOrientable, IWrapper, IDisposable
Examples
    var box = new Efl.Ui.Box();

Constructors

Box(EoWrapper.ConstructingHandle)

Subclasses should override this constructor if they are expected to be instantiated from native code. Do not call this constructor directly.

Declaration
protected Box(EoWrapper.ConstructingHandle ch)
Parameters
Type Name Description
Efl.Eo.EoWrapper.ConstructingHandle ch

Tag struct storing the native handle of the object being constructed.

Box(Object, String)

Initializes a new instance of the Efl.Ui.Box class.

Declaration
public Box(Object parent, string style = null)
Parameters
Type Name Description
Efl.Object parent

Parent instance.

System.String style

The widget style to use. See Efl.Ui.Widget.SetStyle(System.String)

Box(IntPtr, Object)

Initializes a new instance of the Efl.Ui.Box class. Internal usage: Constructor to forward the wrapper initialization to the root class that interfaces with native code. Should not be used directly.

Declaration
protected Box(IntPtr baseKlass, Object parent)
Parameters
Type Name Description
System.IntPtr baseKlass

The pointer to the base native Eo class.

Efl.Object parent

The Efl.Object parent of this instance.

Properties

Homogeneous

In homogeneous mode all children of a vertical Box have the same height, equal to the height of the tallest widget. Children of a horizontal Box have the same width, equal to the width of the widest widget. Otherwise, individual widget sizes are not modified.

Declaration
public bool Homogeneous { get; set; }
Property Value
Type Description
System.Boolean

true if the Box is homogeneous, false otherwise.

Orientation

Control the direction of a given widget. Use this function to change how your widget is to be disposed: vertically or horizontally or inverted vertically or inverted horizontally.

Mirroring as defined in Efl.Ui.II18n (object still in beta stage) can invert the horizontal direction: it is ltr by default, but becomes rtl if the object is mirrored.

Declaration
public LayoutOrientation Orientation { get; set; }
Property Value
Type Description
Efl.Ui.LayoutOrientation

Direction of the widget.

Methods

ClearPack()

Removes all packed sub-objects and unreferences them.

Declaration
public virtual bool ClearPack()
Returns
Type Description
System.Boolean

true on success, false otherwise.

ContentCount()

Returns the number of contained sub-objects. (Since EFL 1.22)

Declaration
public virtual int ContentCount()
Returns
Type Description
System.Int32

Number of sub-objects.

GetHomogeneous()

In homogeneous mode all children of a vertical Box have the same height, equal to the height of the tallest widget. Children of a horizontal Box have the same width, equal to the width of the widest widget. Otherwise, individual widget sizes are not modified.

Declaration
public virtual bool GetHomogeneous()
Returns
Type Description
System.Boolean

true if the Box is homogeneous, false otherwise.

GetOrientation()

Control the direction of a given widget. Use this function to change how your widget is to be disposed: vertically or horizontally or inverted vertically or inverted horizontally.

Mirroring as defined in Efl.Ui.II18n (object still in beta stage) can invert the horizontal direction: it is ltr by default, but becomes rtl if the object is mirrored.

Declaration
public virtual LayoutOrientation GetOrientation()
Returns
Type Description
Efl.Ui.LayoutOrientation

Direction of the widget.

GetPackContent(Int32)

Sub-object at a given index in this container. index ranges from -count to count-1, where positive numbers go from first sub-object (0) to last (count-1), and negative numbers go from last sub-object (-1) to first (-count). count is the number of sub-objects currently in the container as returned by Efl.IContainer.ContentCount().

If index is less than -count, it will return the first sub-object whereas index greater than count-1 will return the last sub-object.

Declaration
public virtual IEntity GetPackContent(int index)
Parameters
Type Name Description
System.Int32 index

Index of the existing sub-object to retrieve. Valid range is -count to count-1.

Returns
Type Description
Efl.Gfx.IEntity

The sub-object contained at the given index.

GetPackIndex(IEntity)

Get the index of a sub-object in this container.

Declaration
public virtual int GetPackIndex(IEntity subobj)
Parameters
Type Name Description
Efl.Gfx.IEntity subobj

An existing sub-object in this container.

Returns
Type Description
System.Int32

-1 in case subobj is not found, or the index of subobj in the range 0 to count-1.

IterateContent()

Begin iterating over this object's contents. (Since EFL 1.22)

Declaration
public virtual Iterator<IEntity> IterateContent()
Returns
Type Description
Eina.Iterator<Efl.Gfx.IEntity>

Iterator on object's content.

LayoutRequest()

Requests EFL to recalculate the layout of this object. Internal layout methods might be called asynchronously.

Declaration
public virtual void LayoutRequest()

OnContentAddedEvent(ContainerContentAddedEventArgs)

Method to raise event ContentAddedEvent.

Declaration
public void OnContentAddedEvent(ContainerContentAddedEventArgs e)
Parameters
Type Name Description
Efl.ContainerContentAddedEventArgs e

Event to raise.

OnContentRemovedEvent(ContainerContentRemovedEventArgs)

Method to raise event ContentRemovedEvent.

Declaration
public void OnContentRemovedEvent(ContainerContentRemovedEventArgs e)
Parameters
Type Name Description
Efl.ContainerContentRemovedEventArgs e

Event to raise.

OnLayoutUpdatedEvent(EventArgs)

Method to raise event LayoutUpdatedEvent.

Declaration
public void OnLayoutUpdatedEvent(EventArgs e)
Parameters
Type Name Description
System.EventArgs e

Event to raise.

Pack(IEntity)

Adds a sub-object to this container. Depending on the container this will either fill in the default spot, replacing any already existing element or append to the end of the container if there is no default part.

When this container is deleted, it will request deletion of the given subobj. Use Efl.IPack.Unpack(Efl.Gfx.IEntity) to remove subobj from this container without deleting it.

Declaration
public virtual bool Pack(IEntity subobj)
Parameters
Type Name Description
Efl.Gfx.IEntity subobj

The object to pack.

Returns
Type Description
System.Boolean

false if subobj could not be packed.

PackAfter(IEntity, IEntity)

Append an object after the existing sub-object. When this container is deleted, it will request deletion of the given subobj. Use Efl.IPack.Unpack(Efl.Gfx.IEntity) to remove subobj from this container without deleting it.

If existing is NULL this method behaves like Efl.IPackLinear.PackEnd(Efl.Gfx.IEntity).

Declaration
public virtual bool PackAfter(IEntity subobj, IEntity existing)
Parameters
Type Name Description
Efl.Gfx.IEntity subobj

Object to pack after existing.

Efl.Gfx.IEntity existing

Existing reference sub-object. Must already belong to the container or be NULL.

Returns
Type Description
System.Boolean

false if existing could not be found or subobj could not be packed.

PackAt(IEntity, Int32)

Inserts subobj BEFORE the sub-object at position index. index ranges from -count to count-1, where positive numbers go from first sub-object (0) to last (count-1), and negative numbers go from last sub-object (-1) to first (-count). count is the number of sub-objects currently in the container as returned by Efl.IContainer.ContentCount().

If index is less than -count, it will trigger Efl.IPackLinear.PackBegin(Efl.Gfx.IEntity) whereas index greater than count-1 will trigger Efl.IPackLinear.PackEnd(Efl.Gfx.IEntity).

When this container is deleted, it will request deletion of the given subobj. Use Efl.IPack.Unpack(Efl.Gfx.IEntity) to remove subobj from this container without deleting it.

Declaration
public virtual bool PackAt(IEntity subobj, int index)
Parameters
Type Name Description
Efl.Gfx.IEntity subobj

Object to pack.

System.Int32 index

Index of existing sub-object to insert BEFORE. Valid range is -count to count-1).

Returns
Type Description
System.Boolean

false if subobj could not be packed.

PackBefore(IEntity, IEntity)

Prepend an object before the existing sub-object. When this container is deleted, it will request deletion of the given subobj. Use Efl.IPack.Unpack(Efl.Gfx.IEntity) to remove subobj from this container without deleting it.

If existing is NULL this method behaves like Efl.IPackLinear.PackBegin(Efl.Gfx.IEntity).

Declaration
public virtual bool PackBefore(IEntity subobj, IEntity existing)
Parameters
Type Name Description
Efl.Gfx.IEntity subobj

Object to pack before existing.

Efl.Gfx.IEntity existing

Existing reference sub-object. Must already belong to the container or be NULL.

Returns
Type Description
System.Boolean

false if existing could not be found or subobj could not be packed.

PackBegin(IEntity)

Prepend an object at the beginning of this container. This is the same as Efl.IPackLinear.PackAt(Efl.Gfx.IEntity, System.Int32) with a 0 index.

When this container is deleted, it will request deletion of the given subobj. Use Efl.IPack.Unpack(Efl.Gfx.IEntity) to remove subobj from this container without deleting it.

Declaration
public virtual bool PackBegin(IEntity subobj)
Parameters
Type Name Description
Efl.Gfx.IEntity subobj

Object to pack at the beginning.

Returns
Type Description
System.Boolean

false if subobj could not be packed.

PackEnd(IEntity)

Append object at the end of this container. This is the same as Efl.IPackLinear.PackAt(Efl.Gfx.IEntity, System.Int32) with a -1 index.

When this container is deleted, it will request deletion of the given subobj. Use Efl.IPack.Unpack(Efl.Gfx.IEntity) to remove subobj from this container without deleting it.

Declaration
public virtual bool PackEnd(IEntity subobj)
Parameters
Type Name Description
Efl.Gfx.IEntity subobj

Object to pack at the end.

Returns
Type Description
System.Boolean

false if subobj could not be packed.

PackUnpackAt(Int32)

Pop out (remove) the sub-object at the specified index. index ranges from -count to count-1, where positive numbers go from first sub-object (0) to last (count-1), and negative numbers go from last sub-object (-1) to first (-count). count is the number of sub-objects currently in the container as returned by Efl.IContainer.ContentCount().

If index is less than -count, it will remove the first sub-object whereas index greater than count-1 will remove the last sub-object.

Declaration
public virtual IEntity PackUnpackAt(int index)
Parameters
Type Name Description
System.Int32 index

Index of the sub-object to remove. Valid range is -count to count-1.

Returns
Type Description
Efl.Gfx.IEntity

The sub-object if it could be removed.

SetHomogeneous(Boolean)

In homogeneous mode all children of a vertical Box have the same height, equal to the height of the tallest widget. Children of a horizontal Box have the same width, equal to the width of the widest widget. Otherwise, individual widget sizes are not modified.

Declaration
public virtual void SetHomogeneous(bool homogeneous)
Parameters
Type Name Description
System.Boolean homogeneous

true if the Box is homogeneous, false otherwise.

SetOrientation(LayoutOrientation)

Control the direction of a given widget. Use this function to change how your widget is to be disposed: vertically or horizontally or inverted vertically or inverted horizontally.

Mirroring as defined in Efl.Ui.II18n (object still in beta stage) can invert the horizontal direction: it is ltr by default, but becomes rtl if the object is mirrored.

Declaration
public virtual void SetOrientation(LayoutOrientation dir)
Parameters
Type Name Description
Efl.Ui.LayoutOrientation dir

Direction of the widget.

Unpack(IEntity)

Removes an existing sub-object from the container without deleting it.

Declaration
public virtual bool Unpack(IEntity subobj)
Parameters
Type Name Description
Efl.Gfx.IEntity subobj

The sub-object to unpack.

Returns
Type Description
System.Boolean

false if subobj wasn't in the container or couldn't be removed.

UnpackAll()

Removes all packed sub-objects without unreferencing them. Use with caution.

Declaration
public virtual bool UnpackAll()
Returns
Type Description
System.Boolean

true on success, false otherwise.

UpdateLayout()

Implementation of this container's layout algorithm. EFL will call this function whenever the contents of this container need to be re-laid out on the canvas.

This can be overridden to implement custom layout behaviors.

Declaration
protected virtual void UpdateLayout()

Events

ContentAddedEvent

Sent after a new sub-object was added. (Since EFL 1.22)

Declaration
public event EventHandler<ContainerContentAddedEventArgs> ContentAddedEvent
Event Type
Type Description
System.EventHandler<Efl.ContainerContentAddedEventArgs>

Efl.ContainerContentAddedEventArgs

ContentRemovedEvent

Sent after a sub-object was removed, before unref. (Since EFL 1.22)

Declaration
public event EventHandler<ContainerContentRemovedEventArgs> ContentRemovedEvent
Event Type
Type Description
System.EventHandler<Efl.ContainerContentRemovedEventArgs>

Efl.ContainerContentRemovedEventArgs

LayoutUpdatedEvent

Sent after the layout was updated.

Declaration
public event EventHandler LayoutUpdatedEvent
Event Type
Type Description
System.EventHandler

Implements

Efl.Canvas.IPointer
Efl.Gfx.IColor
Efl.Gfx.IEntity
Efl.Gfx.IHint
Efl.Gfx.IMapping
Efl.Gfx.IStack
Efl.Input.IInterface
Efl.IPart
Efl.Ui.IPropertyBind
Efl.Ui.IView
Efl.Ui.Focus.IObject
Efl.IPackLayout
Efl.IPackLinear
Efl.IPack
Efl.IContainer
Efl.Ui.ILayoutOrientable
Efl.Eo.IWrapper
Back to top Generated by DocFX