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§

source

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.

source

type Children: Debug + AsRef<Self::Children>

Widget type that is attached to the container and also the root of the components.

source

type Position

Position type used by this widget.

For example GridPosition for gtk::Grid or () for gtk::Box

Required Methods§

source

fn factory_remove(&self, widget: &Self::ReturnedWidget)

Removes a widget.

source

fn factory_append( &self, widget: impl AsRef<Self::Children>, position: &Self::Position ) -> Self::ReturnedWidget

Adds a new widget to self at the end.

source

fn factory_prepend( &self, widget: impl AsRef<Self::Children>, position: &Self::Position ) -> Self::ReturnedWidget

Add an widget to the front.

source

fn factory_insert_after( &self, widget: impl AsRef<Self::Children>, position: &Self::Position, other: &Self::ReturnedWidget ) -> Self::ReturnedWidget

Insert a widget after another widget.

source

fn returned_widget_to_child(root_child: &Self::ReturnedWidget) -> Self::Children

Converts a returned widget to the children type.

source

fn factory_move_after( &self, widget: &Self::ReturnedWidget, other: &Self::ReturnedWidget )

Move an item after another item.

source

fn factory_move_start(&self, widget: &Self::ReturnedWidget)

Move an item to the start.

Provided Methods§

source

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.
§

type Children = Widget

§

type ReturnedWidget = Widget

§

type Position = ()

source§

fn factory_remove(&self, widget: &Widget)

source§

fn factory_append(&self, widget: impl AsRef<Widget>, _: &()) -> Widget

source§

fn factory_prepend(&self, widget: impl AsRef<Widget>, _: &()) -> Widget

source§

fn factory_insert_after( &self, widget: impl AsRef<Widget>, _: &(), other: &Widget ) -> Widget

source§

fn returned_widget_to_child(root_child: &Widget) -> Widget

source§

fn factory_move_after(&self, widget: &Widget, other: &Widget)

source§

fn factory_move_start(&self, widget: &Widget)

§

type Children = Widget

§

type ReturnedWidget = Widget

§

type Position = ()

source§

fn factory_remove(&self, widget: &Self::ReturnedWidget)

source§

fn factory_append( &self, widget: impl AsRef<Self::Children>, _: &Self::Position ) -> Self::ReturnedWidget

source§

fn factory_prepend( &self, widget: impl AsRef<Self::Children>, _position: &() ) -> Self::ReturnedWidget

source§

fn factory_insert_after( &self, widget: impl AsRef<Self::Children>, position: &(), _other: &Self::ReturnedWidget ) -> Self::ReturnedWidget

source§

fn returned_widget_to_child( returned_widget: &Self::ReturnedWidget ) -> Self::Children

source§

fn factory_move_after( &self, widget: &Self::ReturnedWidget, other: &Self::ReturnedWidget )

source§

fn factory_move_start(&self, widget: &Self::ReturnedWidget)

source§

impl FactoryView for Stack

§

type Children = Widget

§

type ReturnedWidget = StackPage

§

type Position = ()

source§

fn factory_remove(&self, widget: &Self::ReturnedWidget)

source§

fn factory_append( &self, widget: impl AsRef<Self::Children>, _position: &Self::Position ) -> Self::ReturnedWidget

source§

fn factory_prepend( &self, widget: impl AsRef<Self::Children>, _position: &() ) -> Self::ReturnedWidget

source§

fn factory_insert_after( &self, widget: impl AsRef<Self::Children>, _position: &(), _other: &Self::ReturnedWidget ) -> Self::ReturnedWidget

source§

fn factory_move_after( &self, _widget: &Self::ReturnedWidget, _other: &Self::ReturnedWidget )

source§

fn factory_move_start(&self, _widget: &Self::ReturnedWidget)

source§

fn returned_widget_to_child( returned_widget: &Self::ReturnedWidget ) -> Self::Children

source§

impl FactoryView for PreferencesPage

Available on crate feature libadwaita only.
§

type Children = PreferencesGroup

§

type ReturnedWidget = PreferencesGroup

§

type Position = ()

source§

fn factory_remove(&self, widget: &Self::ReturnedWidget)

source§

fn factory_append( &self, widget: impl AsRef<Self::Children>, _position: &Self::Position ) -> Self::ReturnedWidget

source§

fn factory_prepend( &self, widget: impl AsRef<Self::Children>, _position: &() ) -> Self::ReturnedWidget

source§

fn factory_insert_after( &self, widget: impl AsRef<Self::Children>, _position: &(), _other: &Self::ReturnedWidget ) -> Self::ReturnedWidget

source§

fn returned_widget_to_child(root_child: &Self::ReturnedWidget) -> Self::Children

source§

fn factory_move_after( &self, _widget: &Self::ReturnedWidget, _other: &Self::ReturnedWidget )

source§

fn factory_move_start(&self, _widget: &Self::ReturnedWidget)

source§

impl FactoryView for FlowBox

§

type Children = Widget

§

type ReturnedWidget = FlowBoxChild

§

type Position = ()

source§

fn factory_remove(&self, widget: &Self::ReturnedWidget)

source§

fn factory_append( &self, widget: impl AsRef<Self::Children>, _position: &() ) -> Self::ReturnedWidget

source§

fn factory_prepend( &self, widget: impl AsRef<Self::Children>, _position: &() ) -> Self::ReturnedWidget

source§

fn factory_insert_after( &self, widget: impl AsRef<Self::Children>, _position: &(), other: &Self::ReturnedWidget ) -> Self::ReturnedWidget

source§

fn factory_move_after( &self, widget: &Self::ReturnedWidget, other: &Self::ReturnedWidget )

source§

fn factory_move_start(&self, widget: &Self::ReturnedWidget)

source§

fn returned_widget_to_child( returned_widget: &Self::ReturnedWidget ) -> Self::Children

source§

impl FactoryView for Grid

§

type Children = Widget

§

type ReturnedWidget = Widget

§

type Position = GridPosition

source§

fn factory_remove(&self, widget: &Self::ReturnedWidget)

source§

fn factory_append( &self, widget: impl AsRef<Self::Children>, position: &Self::Position ) -> Self::ReturnedWidget

source§

fn factory_prepend( &self, widget: impl AsRef<Self::Children>, position: &Self::Position ) -> Self::ReturnedWidget

source§

fn factory_insert_after( &self, widget: impl AsRef<Self::Children>, position: &Self::Position, _other: &Self::ReturnedWidget ) -> Self::ReturnedWidget

source§

fn factory_move_after( &self, _widget: &Self::ReturnedWidget, _other: &Self::ReturnedWidget )

source§

fn factory_move_start(&self, _widget: &Self::ReturnedWidget)

source§

fn returned_widget_to_child( returned_widget: &Self::ReturnedWidget ) -> Self::Children

source§

fn factory_update_position( &self, widget: &Self::ReturnedWidget, position: &Self::Position )

source§

impl FactoryView for ListBox

§

type Children = Widget

§

type ReturnedWidget = ListBoxRow

§

type Position = ()

source§

fn factory_remove(&self, widget: &Self::ReturnedWidget)

source§

fn factory_append( &self, widget: impl AsRef<Self::Children>, _position: &() ) -> Self::ReturnedWidget

source§

fn factory_prepend( &self, widget: impl AsRef<Self::Children>, _position: &() ) -> Self::ReturnedWidget

source§

fn factory_insert_after( &self, widget: impl AsRef<Self::Children>, _position: &(), other: &Self::ReturnedWidget ) -> Self::ReturnedWidget

source§

fn factory_move_after( &self, widget: &Self::ReturnedWidget, other: &Self::ReturnedWidget )

source§

fn factory_move_start(&self, widget: &Self::ReturnedWidget)

source§

fn returned_widget_to_child( returned_widget: &Self::ReturnedWidget ) -> Self::Children

source§

impl FactoryView for PreferencesGroup

Available on crate feature libadwaita only.
§

type Children = Widget

§

type ReturnedWidget = Widget

§

type Position = ()

source§

fn factory_remove(&self, widget: &Self::ReturnedWidget)

source§

fn factory_append( &self, widget: impl AsRef<Self::Children>, _: &Self::Position ) -> Self::ReturnedWidget

source§

fn factory_prepend( &self, widget: impl AsRef<Self::Children>, _position: &() ) -> Self::ReturnedWidget

source§

fn factory_insert_after( &self, widget: impl AsRef<Self::Children>, _position: &(), _other: &Self::ReturnedWidget ) -> Self::ReturnedWidget

source§

fn returned_widget_to_child( returned_widget: &Self::ReturnedWidget ) -> Self::Children

source§

fn factory_move_after( &self, _widget: &Self::ReturnedWidget, _other: &Self::ReturnedWidget )

source§

fn factory_move_start(&self, _widget: &Self::ReturnedWidget)

source§

impl FactoryView for Leaflet

Available on crate feature libadwaita only.
§

type Children = Widget

§

type ReturnedWidget = LeafletPage

§

type Position = ()

source§

fn factory_remove(&self, widget: &Self::ReturnedWidget)

source§

fn factory_append( &self, widget: impl AsRef<Self::Children>, _position: &Self::Position ) -> Self::ReturnedWidget

source§

fn factory_prepend( &self, widget: impl AsRef<Self::Children>, _position: &() ) -> Self::ReturnedWidget

source§

fn factory_insert_after( &self, widget: impl AsRef<Self::Children>, _position: &(), other: &Self::ReturnedWidget ) -> Self::ReturnedWidget

source§

fn factory_move_after( &self, widget: &Self::ReturnedWidget, other: &Self::ReturnedWidget )

source§

fn factory_move_start(&self, widget: &Self::ReturnedWidget)

source§

fn returned_widget_to_child( returned_widget: &Self::ReturnedWidget ) -> Self::Children

source§

impl FactoryView for ExpanderRow

Available on crate feature libadwaita only.
§

type Children = Widget

§

type ReturnedWidget = Widget

§

type Position = ()

source§

fn factory_remove(&self, widget: &Self::ReturnedWidget)

source§

fn factory_append( &self, widget: impl AsRef<Self::Children>, _: &Self::Position ) -> Self::ReturnedWidget

source§

fn factory_prepend( &self, widget: impl AsRef<Self::Children>, position: &Self::Position ) -> Self::ReturnedWidget

source§

fn factory_insert_after( &self, widget: impl AsRef<Self::Children>, position: &Self::Position, _other: &Self::ReturnedWidget ) -> Self::ReturnedWidget

source§

fn factory_move_after( &self, _widget: &Self::ReturnedWidget, _other: &Self::ReturnedWidget )

source§

fn factory_move_start(&self, _widget: &Self::ReturnedWidget)

source§

fn returned_widget_to_child( returned_widget: &Self::ReturnedWidget ) -> Self::Children

source§

fn factory_update_position( &self, widget: &Self::ReturnedWidget, position: &Self::Position )

source§

impl FactoryView for TabView

Available on crate feature libadwaita only.
§

type Children = Widget

§

type ReturnedWidget = TabPage

§

type Position = ()

source§

fn factory_remove(&self, widget: &Self::ReturnedWidget)

source§

fn factory_append( &self, widget: impl AsRef<Self::Children>, _position: &Self::Position ) -> Self::ReturnedWidget

source§

fn factory_prepend( &self, widget: impl AsRef<Self::Children>, _position: &() ) -> Self::ReturnedWidget

source§

fn factory_insert_after( &self, widget: impl AsRef<Self::Children>, _position: &(), other: &Self::ReturnedWidget ) -> Self::ReturnedWidget

source§

fn returned_widget_to_child(root_child: &Self::ReturnedWidget) -> Self::Children

source§

fn factory_move_after( &self, widget: &Self::ReturnedWidget, other: &Self::ReturnedWidget )

source§

fn factory_move_start(&self, widget: &Self::ReturnedWidget)

source§

impl FactoryView for Box

§

type Children = Widget

§

type ReturnedWidget = Widget

§

type Position = ()

source§

fn factory_remove(&self, widget: &Self::ReturnedWidget)

source§

fn factory_append( &self, widget: impl AsRef<Self::Children>, _position: &() ) -> Self::ReturnedWidget

source§

fn factory_prepend( &self, widget: impl AsRef<Self::Children>, _position: &() ) -> Self::ReturnedWidget

source§

fn factory_insert_after( &self, widget: impl AsRef<Self::Children>, _position: &(), other: &Self::ReturnedWidget ) -> Self::ReturnedWidget

source§

fn returned_widget_to_child( returned_widget: &Self::ReturnedWidget ) -> Self::Children

source§

fn factory_move_after( &self, widget: &Self::ReturnedWidget, other: &Self::ReturnedWidget )

source§

fn factory_move_start(&self, widget: &Self::ReturnedWidget)

Implementors§