radar-g/radar-g/src/components/sidebar/bottom_bar.rs
2024-08-23 16:12:27 +08:00

54 lines
1.0 KiB
Rust

use crate::actions::*;
use gtk::prelude::*;
use relm4::{
actions::traits::ActionablePlus, factory::FactoryView, gtk, prelude::*, 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::Button{
set_icon_name=self.icon.as_str(),
ActionablePlus::set_stateless_action::<RemoveLayerAction>: &(),
}
}
fn init_model(init: Self::Init, index: &DynamicIndex, sender: FactorySender<Self>) -> Self {
init
}
fn update(&mut self, message: Self::Input, sender: FactorySender<Self>) {}
}