gtk4::prelude

Trait GridExt

Source
pub trait GridExt: IsA<Grid> + 'static {
Show 27 methods // Provided 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

Trait containing all Grid methods.

§Implementors

Grid

Provided Methods§

Source

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

Source

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

Source

fn baseline_row(&self) -> i32

Returns which row defines the global baseline of @self.

§Returns

the row index defining the global baseline

Source

fn child_at(&self, column: i32, row: i32) -> Option<Widget>

Gets the child of @self whose area covers the grid cell at @column, @row.

§column

the left edge of the cell

§row

the top edge of the cell

§Returns

the child at the given position

Source

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.

Source

fn column_spacing(&self) -> u32

Returns the amount of space between the columns of @self.

§Returns

the column spacing of @self

Source

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

Source

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.

Source

fn row_spacing(&self) -> u32

Returns the amount of space between the rows of @self.

§Returns

the row spacing of @self

Source

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

Source

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

Source

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

Source

fn query_child(&self, child: &impl IsA<Widget>) -> (i32, i32, i32, i32)

Queries the attach points and spans of @child inside the given Grid.

§child

a Widget child of @self

§Returns
§column

the column used to attach the left side of @child

§row

the row used to attach the top side of @child

§width

the number of columns @child spans

§height

the number of rows @child spans

Source

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

Source

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

Source

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

Source

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

Source

fn set_column_homogeneous(&self, homogeneous: bool)

Sets whether all columns of @self will have the same width.

§homogeneous

true to make columns homogeneous

Source

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

Source

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

§pos

a BaselinePosition

Source

fn set_row_homogeneous(&self, homogeneous: bool)

Sets whether all rows of @self will have the same height.

§homogeneous

true to make rows homogeneous

Source

fn set_row_spacing(&self, spacing: u32)

Sets the amount of space between rows of @self.

§spacing

the amount of space to insert between rows

Source

fn connect_baseline_row_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId

Source

fn connect_column_homogeneous_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId

Source

fn connect_column_spacing_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId

Source

fn connect_row_homogeneous_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId

Source

fn connect_row_spacing_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId

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.

Implementors§

Source§

impl<O: IsA<Grid>> GridExt for O