pub trait GridExt: 'static {
Show 27 methods
fn attach(
&self,
child: &impl IsA<Widget>,
column: i32,
row: 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, column: i32, row: 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 query_child(&self, child: &impl IsA<Widget>) -> (i32, i32, i32, i32);
fn remove(&self, child: &impl IsA<Widget>);
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 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§
sourcefn attach(
&self,
child: &impl IsA<Widget>,
column: i32,
row: i32,
width: i32,
height: i32
)
fn attach(
&self,
child: &impl IsA<Widget>,
column: i32,
row: i32,
width: i32,
height: i32
)
Adds a widget to the grid.
The position of @child is determined by @column and @row. The number of “cells” that @child will occupy is determined by @width and @height.
child
the widget to add
column
the column number to attach the left side of @child to
row
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
sourcefn 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][crate::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
sourcefn 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
sourcefn 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.
sourcefn column_spacing(&self) -> u32
fn column_spacing(&self) -> u32
sourcefn row_baseline_position(&self, row: i32) -> BaselinePosition
fn row_baseline_position(&self, row: i32) -> BaselinePosition
Returns the baseline position of @row.
See set_row_baseline_position()
.
row
a row index
Returns
the baseline position of @row
sourcefn 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.
sourcefn row_spacing(&self) -> u32
fn row_spacing(&self) -> u32
sourcefn 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
sourcefn 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
sourcefn 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
sourcefn remove(&self, child: &impl IsA<Widget>)
fn remove(&self, child: &impl IsA<Widget>)
Removes a child from @self.
The child must have been added with
attach()
or attach_next_to()
.
child
the child widget to remove
sourcefn 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
sourcefn 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
sourcefn 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
sourcefn 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
sourcefn 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
sourcefn set_row_baseline_position(&self, row: i32, pos: BaselinePosition)
fn set_row_baseline_position(&self, row: i32, pos: BaselinePosition)
Sets how the baseline should be positioned on @row of the grid, in case that row is assigned more space than is requested.
The default baseline position is BaselinePosition::Center
.
row
a row index