use gtk::prelude::IsA;
use std::fmt::Debug;
pub trait FactoryView: IsA<gtk::Widget> {
type ReturnedWidget: Debug + std::hash::Hash;
type Children: Debug + AsRef<Self::Children>;
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::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);
fn factory_update_position(&self, _widget: &Self::ReturnedWidget, _position: &Self::Position) {}
}
pub trait Position<Pos, Index> {
fn position(&self, index: &Index) -> Pos;
}
impl<C, I> Position<(), I> for C {
fn position(&self, _index: &I) {}
}
pub trait AsyncPosition<Pos> {
fn position(index: usize) -> Pos;
}
impl<C> AsyncPosition<()> for C {
fn position(_index: usize) {}
}