Open msrd0 opened 1 year ago
Sorry, I forgot this.
I have the following example that works:
use gtk::{
IconSize,
Inhibit,
prelude::{ImageExt, ImageExtManual},
prelude::OrientableExt,
prelude::ToolButtonExt,
prelude::WidgetExt,
};
use gtk::Orientation::Vertical;
use relm::{Relm, Widget};
use relm_derive::{Msg, widget};
use self::Msg::*;
#[derive(Clone, Msg)]
pub enum Msg {
Quit,
}
#[widget]
impl Widget for Win {
fn model(_relm: &Relm<Self>, _: ()) -> () {
}
fn update(&mut self, event: Msg) {
match event {
Quit => gtk::main_quit(),
}
}
view! {
gtk::Window {
gtk::Box {
gtk::Toolbar {
gtk::ToolButton {
icon_widget: view! {
gtk::Image {
icon_name: Some("edit-delete"),
icon_size: IconSize::Button
}
}
},
},
orientation: Vertical,
},
delete_event(_, _) => (Quit, Inhibit(false)),
}
}
}
fn main() {
Win::run(()).expect("Win::run failed");
}
Does it work for you?
I have the following code:
At runtime, the entire widget is not rendered, and instead I see this message on the terminal:
The macro outputs the following code, which I believe is wrong:
The widget is added inside a
gtk::Box
in another widget, but what I believe is happening is that only the image in the innerview!
macro is being added, instead of the outerview!
macro.