pub trait LayoutManagerExt: IsA<LayoutManager> + 'static {
// Provided methods
fn allocate(
&self,
widget: &impl IsA<Widget>,
width: i32,
height: i32,
baseline: i32,
) { ... }
fn layout_child(&self, child: &impl IsA<Widget>) -> LayoutChild { ... }
fn request_mode(&self) -> SizeRequestMode { ... }
fn widget(&self) -> Option<Widget> { ... }
fn layout_changed(&self) { ... }
fn measure(
&self,
widget: &impl IsA<Widget>,
orientation: Orientation,
for_size: i32,
) -> (i32, i32, i32, i32) { ... }
}
Expand description
Trait containing all LayoutManager
methods.
§Implementors
BinLayout
, BoxLayout
, CenterLayout
, ConstraintLayout
, FixedLayout
, GridLayout
, LayoutManager
, OverlayLayout
Provided Methods§
Sourcefn allocate(
&self,
widget: &impl IsA<Widget>,
width: i32,
height: i32,
baseline: i32,
)
fn allocate( &self, widget: &impl IsA<Widget>, width: i32, height: i32, baseline: i32, )
Assigns the given @width, @height, and @baseline to a @widget, and computes the position and sizes of the children of the @widget using the layout management policy of @self.
§widget
the Widget
using @self
§width
the new width of the @widget
§height
the new height of the @widget
§baseline
the baseline position of the @widget, or -1
Sourcefn layout_child(&self, child: &impl IsA<Widget>) -> LayoutChild
fn layout_child(&self, child: &impl IsA<Widget>) -> LayoutChild
Retrieves a LayoutChild
instance for the LayoutManager
,
creating one if necessary.
The @child widget must be a child of the widget using @self.
The LayoutChild
instance is owned by the LayoutManager
,
and is guaranteed to exist as long as @child is a child of the
Widget
using the given LayoutManager
.
§child
a Widget
§Returns
Sourcefn request_mode(&self) -> SizeRequestMode
fn request_mode(&self) -> SizeRequestMode
Sourcefn layout_changed(&self)
fn layout_changed(&self)
Queues a resize on the Widget
using @self, if any.
This function should be called by subclasses of LayoutManager
in response to changes to their layout management policies.
Sourcefn measure(
&self,
widget: &impl IsA<Widget>,
orientation: Orientation,
for_size: i32,
) -> (i32, i32, i32, i32)
fn measure( &self, widget: &impl IsA<Widget>, orientation: Orientation, for_size: i32, ) -> (i32, i32, i32, i32)
Measures the size of the @widget using @self, for the given @orientation and size.
See the Widget
documentation on layout management for
more details.
§widget
the Widget
using @self
§orientation
the orientation to measure
§for_size
Size for the opposite of @orientation; for instance, if
the @orientation is Orientation::Horizontal
, this is the height
of the widget; if the @orientation is Orientation::Vertical
, this
is the width of the widget. This allows to measure the height for the
given width, and the width for the given height. Use -1 if the size
is not known
§Returns
§minimum
the minimum size for the given size and orientation
§natural
the natural, or preferred size for the given size and orientation
§minimum_baseline
the baseline position for the minimum size
§natural_baseline
the baseline position for the natural size
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.