libcosmic/examples/dock/dock_item/imp.rs

35 lines
796 B
Rust
Raw Normal View History

2021-12-30 16:54:35 -05:00
use gtk4::glib;
use gtk4::prelude::*;
use gtk4::subclass::prelude::*;
use gtk4::CompositeTemplate;
#[derive(Debug, Default, CompositeTemplate)]
2021-12-15 11:37:28 -05:00
#[template(file = "dock_item.ui")]
pub struct DockItem {
#[template_child]
2021-12-30 16:54:35 -05:00
pub image: TemplateChild<gtk4::Image>,
#[template_child]
2021-12-30 16:54:35 -05:00
pub dots: TemplateChild<gtk4::Label>,
}
#[glib::object_subclass]
2021-12-15 11:37:28 -05:00
impl ObjectSubclass for DockItem {
const NAME: &'static str = "DockItem";
type Type = super::DockItem;
2021-12-30 16:54:35 -05:00
type ParentType = gtk4::Box;
fn class_init(klass: &mut Self::Class) {
Self::bind_template(klass);
}
fn instance_init(obj: &glib::subclass::InitializingObject<Self>) {
obj.init_template();
}
}
2021-12-15 11:37:28 -05:00
impl ObjectImpl for DockItem {}
2021-12-15 11:37:28 -05:00
impl WidgetImpl for DockItem {}
2021-12-15 11:37:28 -05:00
impl BoxImpl for DockItem {}