Trait pushrod::core::layout_manager::LayoutManager
source · pub trait LayoutManager {
// Required methods
fn do_layout(
&mut self,
origin: Point,
size: Size,
coordinates: LayoutManagerCoordinates,
) -> LayoutManagerCoordinates;
fn get_widget_id(&self) -> i32;
}Expand description
Describes the behavior of a LayoutManager. Layout Managers do not actually manage any
Widget objects by themselves, they only apply the rules of the LayoutManagerPadding
coordinates, and the size of the LayoutManager that is available.
Required Methods§
sourcefn do_layout(
&mut self,
origin: Point,
size: Size,
coordinates: LayoutManagerCoordinates,
) -> LayoutManagerCoordinates
fn do_layout( &mut self, origin: Point, size: Size, coordinates: LayoutManagerCoordinates, ) -> LayoutManagerCoordinates
This method is called when a new Widget is added to the list, or the layout needs to
be re-computed (due to a resize). The origin passed is the origin of the layout
manager’s top-level Widget, as each LayoutManager requires a Widget against which
objects can be added. size indicates the Size of the Widget container, which is
the total allowed bounds of the objects within its layout area. coordinates are the
coordinates of the Widgets to be resized. Once the compute of all of the coordinates
of all of the objects is completed, a new LayoutManagerCoordinates object must be
returned, containing the new coordinates of all of the objects within its bounds.
See also HorizontalLayoutManager and VerticalLayoutManager for more info.
sourcefn get_widget_id(&self) -> i32
fn get_widget_id(&self) -> i32
This function must be overridden to return the ID of the Widget that is stored within
the LayoutManager, since the system doesn’t have direct access to it.