Trait gtk4::prelude::LayoutManagerExt [−][src]
pub trait LayoutManagerExt: 'static {
fn allocate<P: IsA<Widget>>(
&self,
widget: &P,
width: i32,
height: i32,
baseline: i32
);
fn layout_child<P: IsA<Widget>>(&self, child: &P) -> Option<LayoutChild>;
fn request_mode(&self) -> SizeRequestMode;
fn widget(&self) -> Option<Widget>;
fn layout_changed(&self);
fn measure<P: IsA<Widget>>(
&self,
widget: &P,
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
Required methods
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
fn layout_child<P: IsA<Widget>>(&self, child: &P) -> Option<LayoutChild>
fn layout_child<P: IsA<Widget>>(&self, child: &P) -> Option<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
fn request_mode(&self) -> SizeRequestMode
fn request_mode(&self) -> SizeRequestMode
fn 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.
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