allocate_area


Description:

public abstract void allocate_area (Context cr, CanvasBounds requested_area, CanvasBounds allocated_area, double x_offset, double y_offset)

This function is only intended to be used when implementing new canvas items, specifically layout items such as CanvasTable.

It allocates an area to a child CanvasItem.

Note that the parent layout item will use a transform to move each of its children for the layout, so there is no need for the child item to reposition itself. It only needs to recalculate its device bounds.

To help recalculate the item's device bounds, the x_offset and y_offset of the child item's allocated position from its requested position are provided. Simple items can just add these to their bounds.

Parameters:

this

a CanvasItem.

cr

a cairo context.

requested_area

the area that the item originally requested, in the parent's coordinate space.

allocated_area

the area that the item has been allocated, in the parent's coordinate space.

x_offset

the x offset of the allocated area from the requested area in the device coordinate space.

y_offset

the y offset of the allocated area from the requested area in the device coordinate space.