nmrs_gui/objects/
theme.rs1use gtk::glib;
2use gtk::subclass::prelude::ObjectSubclassIsExt;
3
4mod imp {
5 use super::*;
6 use crate::objects::theme::glib::subclass::prelude::ObjectImpl;
7 use crate::objects::theme::glib::subclass::prelude::ObjectSubclass;
8 use std::cell::RefCell;
9
10 #[derive(Default)]
11 pub struct Theme {
12 pub label: RefCell<String>,
13 }
14
15 #[glib::object_subclass]
16 impl ObjectSubclass for Theme {
17 const NAME: &'static str = "ThemeObject";
18 type Type = super::Theme;
19 }
20
21 impl ObjectImpl for Theme {}
22}
23
24glib::wrapper! {
25 pub struct Theme(ObjectSubclass<imp::Theme>);
26}
27
28impl Theme {
29 pub fn new(label: &str) -> Self {
30 let obj: Self = glib::Object::new();
31 obj.imp().label.replace(label.to_string());
32 obj
33 }
34
35 pub fn label(&self) -> String {
36 self.imp().label.borrow().clone()
37 }
38}