use gtk::prelude::*; use relm4::{ factory::FactoryView, gtk, prelude::{DynamicIndex, FactoryComponent}, FactorySender, }; use super::SideBarInputMsg; #[derive(Debug)] pub enum TestMsg { Delete, MoveUp, MoveDown, Add, } pub struct BottomBarModel { icon: String, msg: TestMsg, } impl BottomBarModel { pub fn new(icon: String) -> Self { Self { icon, msg: TestMsg::Add, } } } #[relm4::factory(pub)] impl FactoryComponent for BottomBarModel { type ParentWidget = gtk::Box; type Input = (); type Output = TestMsg; type Init = BottomBarModel; type CommandOutput = (); view! { #[root] gtk::Box{ gtk::Button{ set_icon_name=self.icon.as_str(), } } } fn init_model(init: Self::Init, index: &DynamicIndex, sender: FactorySender) -> Self { init } fn update(&mut self, message: Self::Input, sender: FactorySender) {} }