snespatcher/src/popover.rs

60 lines
1.8 KiB
Rust
Raw Permalink Normal View History

2021-08-25 18:37:59 -05:00
use gtk4::prelude::*;
use gtk4::{
2022-05-23 19:32:33 -05:00
AboutDialog,
2021-08-25 18:37:59 -05:00
glib::*,
Button,
Popover,
2022-05-23 19:32:33 -05:00
License,
2021-08-25 18:37:59 -05:00
Box,
Orientation,
};
#[derive(Debug, Clone, Downgrade)]
pub struct CustomPopoverMenu {
pub popover: Popover,
pub pop_box: Box,
pub test_text_view:Button,
pub subtest_text_view: Button,
}
impl CustomPopoverMenu {
pub fn new() -> CustomPopoverMenu {
CustomPopoverMenu {
popover: Popover::new(),
pop_box: Box::new(Orientation::Vertical, 0),
test_text_view: Button::new(),
subtest_text_view: Button::new(),
}
}
pub fn set_texts(&self) {
self.test_text_view.set_label("About");
self.subtest_text_view.set_label("Psyche!");
self.pop_box.append(&self.test_text_view);
self.pop_box.append(&self.subtest_text_view);
self.pop_box.set_visible(true);
self.popover.set_child(Some(&self.pop_box));
2022-05-23 19:32:33 -05:00
}
pub fn click_about_button(&self,
//window: Rc<ApplicationWindow>
) {
self.test_text_view.connect_clicked(clone!(@strong self as this =>
move |_| {
let about_dialog = AboutDialog::builder()
.program_name("SNESPatcher")
.version("0.1.0")
.comments("GTK4 app to patch your SNES ROMs!")
.authors(["Wyatt J. Miller".to_string()].to_vec())
.documenters(["Wyatt J. Miller".to_string()].to_vec())
.license_type(License::Mpl20)
.website("https://scm.wyattjmiller.com/wymiller/snespatcher")
.website_label("Website?")
.modal(false)
.can_focus(true)
//.child(&window)
.build();
about_dialog.show();
}));
}
2021-08-25 18:37:59 -05:00
}