pub trait FactoryPrototype: Sized {
    type Factory: Factory<Self, Self::View>;
    type Widgets: Debug;
    type Root: WidgetExt;
    type View: FactoryView<Self::Root>;
    type Msg;

    // Required methods
    fn init_view(
        &self,
        key: &<Self::Factory as Factory<Self, Self::View>>::Key,
        sender: Sender<Self::Msg>
    ) -> Self::Widgets;
    fn position(
        &self,
        key: &<Self::Factory as Factory<Self, Self::View>>::Key
    ) -> <Self::View as FactoryView<Self::Root>>::Position;
    fn view(
        &self,
        key: &<Self::Factory as Factory<Self, Self::View>>::Key,
        widgets: &Self::Widgets
    );
    fn root_widget(widgets: &Self::Widgets) -> &Self::Root;
}
Expand description

Define behavior to create, update and remove widgets according to data stored in a factory.

Required Associated Types§

source

type Factory: Factory<Self, Self::View>

Factory container that stores the data.

source

type Widgets: Debug

Type that stores all widgets needed to update them in the view function.

source

type Root: WidgetExt

Outermost type of the newly created widgets. Similar to the Root type in crate::Widgets.

source

type View: FactoryView<Self::Root>

Widget that the generated widgets are added to.

source

type Msg

Message type used to send messages back to the component or app where this factory is used

Required Methods§

source

fn init_view( &self, key: &<Self::Factory as Factory<Self, Self::View>>::Key, sender: Sender<Self::Msg> ) -> Self::Widgets

Create new widgets when self is inserted into the factory.

source

fn position( &self, key: &<Self::Factory as Factory<Self, Self::View>>::Key ) -> <Self::View as FactoryView<Self::Root>>::Position

Set the widget position upon creation, useful for gtk::Grid or similar.

source

fn view( &self, key: &<Self::Factory as Factory<Self, Self::View>>::Key, widgets: &Self::Widgets )

Function called when self is modified.

source

fn root_widget(widgets: &Self::Widgets) -> &Self::Root

Get the outermost widget from the widgets.

Implementors§