pub trait GridExt: 'static {
Show 33 methods
fn attach(
&self,
child: &impl IsA<Widget>,
left: i32,
top: i32,
width: i32,
height: i32
);
fn attach_next_to(
&self,
child: &impl IsA<Widget>,
sibling: Option<&impl IsA<Widget>>,
side: PositionType,
width: i32,
height: i32
);
fn baseline_row(&self) -> i32;
fn child_at(&self, left: i32, top: i32) -> Option<Widget>;
fn is_column_homogeneous(&self) -> bool;
fn column_spacing(&self) -> u32;
fn row_baseline_position(&self, row: i32) -> BaselinePosition;
fn is_row_homogeneous(&self) -> bool;
fn row_spacing(&self) -> u32;
fn insert_column(&self, position: i32);
fn insert_next_to(&self, sibling: &impl IsA<Widget>, side: PositionType);
fn insert_row(&self, position: i32);
fn remove_column(&self, position: i32);
fn remove_row(&self, position: i32);
fn set_baseline_row(&self, row: i32);
fn set_column_homogeneous(&self, homogeneous: bool);
fn set_column_spacing(&self, spacing: u32);
fn set_row_baseline_position(&self, row: i32, pos: BaselinePosition);
fn set_row_homogeneous(&self, homogeneous: bool);
fn set_row_spacing(&self, spacing: u32);
fn cell_height<T: IsA<Widget>>(&self, item: &T) -> i32;
fn set_cell_height<T: IsA<Widget>>(&self, item: &T, height: i32);
fn cell_width<T: IsA<Widget>>(&self, item: &T) -> i32;
fn set_cell_width<T: IsA<Widget>>(&self, item: &T, width: i32);
fn cell_left_attach<T: IsA<Widget>>(&self, item: &T) -> i32;
fn set_cell_left_attach<T: IsA<Widget>>(&self, item: &T, left_attach: i32);
fn cell_top_attach<T: IsA<Widget>>(&self, item: &T) -> i32;
fn set_cell_top_attach<T: IsA<Widget>>(&self, item: &T, top_attach: i32);
fn connect_baseline_row_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId;
fn connect_column_homogeneous_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId;
fn connect_column_spacing_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId;
fn connect_row_homogeneous_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId;
fn connect_row_spacing_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId;
}
Expand description
Required Methods
Adds a widget to the grid.
The position of child
is determined by left
and top
. The
number of “cells” that child
will occupy is determined by
width
and height
.
child
the widget to add
left
the column number to attach the left side of child
to
top
the row number to attach the top side of child
to
width
the number of columns that child
will span
height
the number of rows that child
will span
fn attach_next_to(
&self,
child: &impl IsA<Widget>,
sibling: Option<&impl IsA<Widget>>,
side: PositionType,
width: i32,
height: i32
)
fn attach_next_to(
&self,
child: &impl IsA<Widget>,
sibling: Option<&impl IsA<Widget>>,
side: PositionType,
width: i32,
height: i32
)
Adds a widget to the grid.
The widget is placed next to sibling
, on the side determined by
side
. When sibling
is None
, the widget is placed in row (for
left or right placement) or column 0 (for top or bottom placement),
at the end indicated by side
.
Attaching widgets labeled [1], [2], [3] with sibling
== None
and
side
== PositionType::Left
yields a layout of [3][2][1].
child
the widget to add
sibling
the child of self
that child
will be placed
next to, or None
to place child
at the beginning or end
side
the side of sibling
that child
is positioned next to
width
the number of columns that child
will span
height
the number of rows that child
will span
fn baseline_row(&self) -> i32
fn baseline_row(&self) -> i32
Returns which row defines the global baseline of self
.
Returns
the row index defining the global baseline
fn is_column_homogeneous(&self) -> bool
fn is_column_homogeneous(&self) -> bool
Returns whether all columns of self
have the same width.
Returns
whether all columns of self
have the same width.
fn column_spacing(&self) -> u32
fn column_spacing(&self) -> u32
fn row_baseline_position(&self, row: i32) -> BaselinePosition
fn row_baseline_position(&self, row: i32) -> BaselinePosition
Returns the baseline position of row
as set
by set_row_baseline_position()
or the default value
BaselinePosition::Center
.
row
a row index
Returns
the baseline position of row
fn is_row_homogeneous(&self) -> bool
fn is_row_homogeneous(&self) -> bool
Returns whether all rows of self
have the same height.
Returns
whether all rows of self
have the same height.
fn row_spacing(&self) -> u32
fn row_spacing(&self) -> u32
fn insert_column(&self, position: i32)
fn insert_column(&self, position: i32)
Inserts a column at the specified position.
Children which are attached at or to the right of this position are moved one column to the right. Children which span across this position are grown to span the new column.
position
the position to insert the column at
fn insert_next_to(&self, sibling: &impl IsA<Widget>, side: PositionType)
fn insert_next_to(&self, sibling: &impl IsA<Widget>, side: PositionType)
Inserts a row or column at the specified position.
The new row or column is placed next to sibling
, on the side
determined by side
. If side
is PositionType::Top
or PositionType::Bottom
,
a row is inserted. If side
is PositionType::Left
of PositionType::Right
,
a column is inserted.
sibling
the child of self
that the new row or column will be
placed next to
side
the side of sibling
that child
is positioned next to
fn insert_row(&self, position: i32)
fn insert_row(&self, position: i32)
Inserts a row at the specified position.
Children which are attached at or below this position are moved one row down. Children which span across this position are grown to span the new row.
position
the position to insert the row at
fn remove_column(&self, position: i32)
fn remove_column(&self, position: i32)
Removes a column from the grid.
Children that are placed in this column are removed, spanning children that overlap this column have their width reduced by one, and children after the column are moved to the left.
position
the position of the column to remove
fn remove_row(&self, position: i32)
fn remove_row(&self, position: i32)
Removes a row from the grid.
Children that are placed in this row are removed, spanning children that overlap this row have their height reduced by one, and children below the row are moved up.
position
the position of the row to remove
fn set_baseline_row(&self, row: i32)
fn set_baseline_row(&self, row: i32)
Sets which row defines the global baseline for the entire grid.
Each row in the grid can have its own local baseline, but only
one of those is global, meaning it will be the baseline in the
parent of the self
.
row
the row index
fn set_column_homogeneous(&self, homogeneous: bool)
fn set_column_homogeneous(&self, homogeneous: bool)
Sets whether all columns of self
will have the same width.
homogeneous
true
to make columns homogeneous
fn set_column_spacing(&self, spacing: u32)
fn set_column_spacing(&self, spacing: u32)
Sets the amount of space between columns of self
.
spacing
the amount of space to insert between columns