pub trait FactoryView: IsA<Widget> {
type ReturnedWidget: Debug + Hash;
type Children: Debug + AsRef<Self::Children>;
type Position;
// Required methods
fn factory_remove(&self, widget: &Self::ReturnedWidget);
fn factory_append(
&self,
widget: impl AsRef<Self::Children>,
position: &Self::Position
) -> Self::ReturnedWidget;
fn factory_prepend(
&self,
widget: impl AsRef<Self::Children>,
position: &Self::Position
) -> Self::ReturnedWidget;
fn factory_insert_after(
&self,
widget: impl AsRef<Self::Children>,
position: &Self::Position,
other: &Self::ReturnedWidget
) -> Self::ReturnedWidget;
fn returned_widget_to_child(
root_child: &Self::ReturnedWidget
) -> Self::Children;
fn factory_move_after(
&self,
widget: &Self::ReturnedWidget,
other: &Self::ReturnedWidget
);
fn factory_move_start(&self, widget: &Self::ReturnedWidget);
// Provided method
fn factory_update_position(
&self,
_widget: &Self::ReturnedWidget,
_position: &Self::Position
) { ... }
}
Expand description
A trait implemented for GTK4 widgets that allows a factory to create and remove widgets.
Required Associated Types§
sourcetype ReturnedWidget: Debug + Hash
type ReturnedWidget: Debug + Hash
The widget returned when inserting a widget.
This doesn’t matter on containers like gtk::Box
.
However, widgets such as gtk::Stack
return a gtk::StackPage
which might be used to set additional parameters.
Therefore, this “returned widget” is explicitly handled here.
sourcetype Children: Debug + AsRef<Self::Children>
type Children: Debug + AsRef<Self::Children>
Widget type that is attached to the container and also the root of the components.
sourcetype Position
type Position
Position type used by this widget.
For example GridPosition
for gtk::Grid
or ()
for gtk::Box
Required Methods§
sourcefn factory_remove(&self, widget: &Self::ReturnedWidget)
fn factory_remove(&self, widget: &Self::ReturnedWidget)
Removes a widget.
sourcefn factory_append(
&self,
widget: impl AsRef<Self::Children>,
position: &Self::Position
) -> Self::ReturnedWidget
fn factory_append( &self, widget: impl AsRef<Self::Children>, position: &Self::Position ) -> Self::ReturnedWidget
Adds a new widget to self at the end.
sourcefn factory_prepend(
&self,
widget: impl AsRef<Self::Children>,
position: &Self::Position
) -> Self::ReturnedWidget
fn factory_prepend( &self, widget: impl AsRef<Self::Children>, position: &Self::Position ) -> Self::ReturnedWidget
Add an widget to the front.
sourcefn factory_insert_after(
&self,
widget: impl AsRef<Self::Children>,
position: &Self::Position,
other: &Self::ReturnedWidget
) -> Self::ReturnedWidget
fn factory_insert_after( &self, widget: impl AsRef<Self::Children>, position: &Self::Position, other: &Self::ReturnedWidget ) -> Self::ReturnedWidget
Insert a widget after another widget.
sourcefn returned_widget_to_child(root_child: &Self::ReturnedWidget) -> Self::Children
fn returned_widget_to_child(root_child: &Self::ReturnedWidget) -> Self::Children
Converts a returned widget to the children type.
sourcefn factory_move_after(
&self,
widget: &Self::ReturnedWidget,
other: &Self::ReturnedWidget
)
fn factory_move_after( &self, widget: &Self::ReturnedWidget, other: &Self::ReturnedWidget )
Move an item after another item.
sourcefn factory_move_start(&self, widget: &Self::ReturnedWidget)
fn factory_move_start(&self, widget: &Self::ReturnedWidget)
Move an item to the start.
Provided Methods§
sourcefn factory_update_position(
&self,
_widget: &Self::ReturnedWidget,
_position: &Self::Position
)
fn factory_update_position( &self, _widget: &Self::ReturnedWidget, _position: &Self::Position )
Update the position inside positioned containers like gtk::Grid
.
Implementations on Foreign Types§
source§impl FactoryView for Paned
Available on crate feature libpanel
only.
impl FactoryView for Paned
libpanel
only.type Children = Widget
type ReturnedWidget = Widget
type Position = ()
fn factory_remove(&self, widget: &Widget)
fn factory_append(&self, widget: impl AsRef<Widget>, _: &()) -> Widget
fn factory_prepend(&self, widget: impl AsRef<Widget>, _: &()) -> Widget
fn factory_insert_after( &self, widget: impl AsRef<Widget>, _: &(), other: &Widget ) -> Widget
fn returned_widget_to_child(root_child: &Widget) -> Widget
fn factory_move_after(&self, widget: &Widget, other: &Widget)
fn factory_move_start(&self, widget: &Widget)
source§impl FactoryView for Carousel
Available on crate feature libadwaita
only.
impl FactoryView for Carousel
libadwaita
only.type Children = Widget
type ReturnedWidget = Widget
type Position = ()
fn factory_remove(&self, widget: &Self::ReturnedWidget)
fn factory_append( &self, widget: impl AsRef<Self::Children>, _: &Self::Position ) -> Self::ReturnedWidget
fn factory_prepend( &self, widget: impl AsRef<Self::Children>, _position: &() ) -> Self::ReturnedWidget
fn factory_insert_after( &self, widget: impl AsRef<Self::Children>, position: &(), _other: &Self::ReturnedWidget ) -> Self::ReturnedWidget
fn returned_widget_to_child( returned_widget: &Self::ReturnedWidget ) -> Self::Children
fn factory_move_after( &self, widget: &Self::ReturnedWidget, other: &Self::ReturnedWidget )
fn factory_move_start(&self, widget: &Self::ReturnedWidget)
source§impl FactoryView for Stack
impl FactoryView for Stack
type Children = Widget
type ReturnedWidget = StackPage
type Position = ()
fn factory_remove(&self, widget: &Self::ReturnedWidget)
fn factory_append( &self, widget: impl AsRef<Self::Children>, _position: &Self::Position ) -> Self::ReturnedWidget
fn factory_prepend( &self, widget: impl AsRef<Self::Children>, _position: &() ) -> Self::ReturnedWidget
fn factory_insert_after( &self, widget: impl AsRef<Self::Children>, _position: &(), _other: &Self::ReturnedWidget ) -> Self::ReturnedWidget
fn factory_move_after( &self, _widget: &Self::ReturnedWidget, _other: &Self::ReturnedWidget )
fn factory_move_start(&self, _widget: &Self::ReturnedWidget)
fn returned_widget_to_child( returned_widget: &Self::ReturnedWidget ) -> Self::Children
source§impl FactoryView for PreferencesPage
Available on crate feature libadwaita
only.
impl FactoryView for PreferencesPage
libadwaita
only.type Children = PreferencesGroup
type ReturnedWidget = PreferencesGroup
type Position = ()
fn factory_remove(&self, widget: &Self::ReturnedWidget)
fn factory_append( &self, widget: impl AsRef<Self::Children>, _position: &Self::Position ) -> Self::ReturnedWidget
fn factory_prepend( &self, widget: impl AsRef<Self::Children>, _position: &() ) -> Self::ReturnedWidget
fn factory_insert_after( &self, widget: impl AsRef<Self::Children>, _position: &(), _other: &Self::ReturnedWidget ) -> Self::ReturnedWidget
fn returned_widget_to_child(root_child: &Self::ReturnedWidget) -> Self::Children
fn factory_move_after( &self, _widget: &Self::ReturnedWidget, _other: &Self::ReturnedWidget )
fn factory_move_start(&self, _widget: &Self::ReturnedWidget)
source§impl FactoryView for FlowBox
impl FactoryView for FlowBox
type Children = Widget
type ReturnedWidget = FlowBoxChild
type Position = ()
fn factory_remove(&self, widget: &Self::ReturnedWidget)
fn factory_append( &self, widget: impl AsRef<Self::Children>, _position: &() ) -> Self::ReturnedWidget
fn factory_prepend( &self, widget: impl AsRef<Self::Children>, _position: &() ) -> Self::ReturnedWidget
fn factory_insert_after( &self, widget: impl AsRef<Self::Children>, _position: &(), other: &Self::ReturnedWidget ) -> Self::ReturnedWidget
fn factory_move_after( &self, widget: &Self::ReturnedWidget, other: &Self::ReturnedWidget )
fn factory_move_start(&self, widget: &Self::ReturnedWidget)
fn returned_widget_to_child( returned_widget: &Self::ReturnedWidget ) -> Self::Children
source§impl FactoryView for Grid
impl FactoryView for Grid
type Children = Widget
type ReturnedWidget = Widget
type Position = GridPosition
fn factory_remove(&self, widget: &Self::ReturnedWidget)
fn factory_append( &self, widget: impl AsRef<Self::Children>, position: &Self::Position ) -> Self::ReturnedWidget
fn factory_prepend( &self, widget: impl AsRef<Self::Children>, position: &Self::Position ) -> Self::ReturnedWidget
fn factory_insert_after( &self, widget: impl AsRef<Self::Children>, position: &Self::Position, _other: &Self::ReturnedWidget ) -> Self::ReturnedWidget
fn factory_move_after( &self, _widget: &Self::ReturnedWidget, _other: &Self::ReturnedWidget )
fn factory_move_start(&self, _widget: &Self::ReturnedWidget)
fn returned_widget_to_child( returned_widget: &Self::ReturnedWidget ) -> Self::Children
fn factory_update_position( &self, widget: &Self::ReturnedWidget, position: &Self::Position )
source§impl FactoryView for ListBox
impl FactoryView for ListBox
type Children = Widget
type ReturnedWidget = ListBoxRow
type Position = ()
fn factory_remove(&self, widget: &Self::ReturnedWidget)
fn factory_append( &self, widget: impl AsRef<Self::Children>, _position: &() ) -> Self::ReturnedWidget
fn factory_prepend( &self, widget: impl AsRef<Self::Children>, _position: &() ) -> Self::ReturnedWidget
fn factory_insert_after( &self, widget: impl AsRef<Self::Children>, _position: &(), other: &Self::ReturnedWidget ) -> Self::ReturnedWidget
fn factory_move_after( &self, widget: &Self::ReturnedWidget, other: &Self::ReturnedWidget )
fn factory_move_start(&self, widget: &Self::ReturnedWidget)
fn returned_widget_to_child( returned_widget: &Self::ReturnedWidget ) -> Self::Children
source§impl FactoryView for PreferencesGroup
Available on crate feature libadwaita
only.
impl FactoryView for PreferencesGroup
libadwaita
only.type Children = Widget
type ReturnedWidget = Widget
type Position = ()
fn factory_remove(&self, widget: &Self::ReturnedWidget)
fn factory_append( &self, widget: impl AsRef<Self::Children>, _: &Self::Position ) -> Self::ReturnedWidget
fn factory_prepend( &self, widget: impl AsRef<Self::Children>, _position: &() ) -> Self::ReturnedWidget
fn factory_insert_after( &self, widget: impl AsRef<Self::Children>, _position: &(), _other: &Self::ReturnedWidget ) -> Self::ReturnedWidget
fn returned_widget_to_child( returned_widget: &Self::ReturnedWidget ) -> Self::Children
fn factory_move_after( &self, _widget: &Self::ReturnedWidget, _other: &Self::ReturnedWidget )
fn factory_move_start(&self, _widget: &Self::ReturnedWidget)
source§impl FactoryView for Leaflet
Available on crate feature libadwaita
only.
impl FactoryView for Leaflet
libadwaita
only.type Children = Widget
type ReturnedWidget = LeafletPage
type Position = ()
fn factory_remove(&self, widget: &Self::ReturnedWidget)
fn factory_append( &self, widget: impl AsRef<Self::Children>, _position: &Self::Position ) -> Self::ReturnedWidget
fn factory_prepend( &self, widget: impl AsRef<Self::Children>, _position: &() ) -> Self::ReturnedWidget
fn factory_insert_after( &self, widget: impl AsRef<Self::Children>, _position: &(), other: &Self::ReturnedWidget ) -> Self::ReturnedWidget
fn factory_move_after( &self, widget: &Self::ReturnedWidget, other: &Self::ReturnedWidget )
fn factory_move_start(&self, widget: &Self::ReturnedWidget)
fn returned_widget_to_child( returned_widget: &Self::ReturnedWidget ) -> Self::Children
source§impl FactoryView for ExpanderRow
Available on crate feature libadwaita
only.
impl FactoryView for ExpanderRow
libadwaita
only.type Children = Widget
type ReturnedWidget = Widget
type Position = ()
fn factory_remove(&self, widget: &Self::ReturnedWidget)
fn factory_append( &self, widget: impl AsRef<Self::Children>, _: &Self::Position ) -> Self::ReturnedWidget
fn factory_prepend( &self, widget: impl AsRef<Self::Children>, position: &Self::Position ) -> Self::ReturnedWidget
fn factory_insert_after( &self, widget: impl AsRef<Self::Children>, position: &Self::Position, _other: &Self::ReturnedWidget ) -> Self::ReturnedWidget
fn factory_move_after( &self, _widget: &Self::ReturnedWidget, _other: &Self::ReturnedWidget )
fn factory_move_start(&self, _widget: &Self::ReturnedWidget)
fn returned_widget_to_child( returned_widget: &Self::ReturnedWidget ) -> Self::Children
fn factory_update_position( &self, widget: &Self::ReturnedWidget, position: &Self::Position )
source§impl FactoryView for TabView
Available on crate feature libadwaita
only.
impl FactoryView for TabView
libadwaita
only.