49 lines
1.1 KiB
Rust
49 lines
1.1 KiB
Rust
|
use std::rc::Rc;
|
||
|
use futures::executor::block_on;
|
||
|
use gtk4::prelude::*;
|
||
|
use gtk4::subclass::prelude::*;
|
||
|
use gtk4::{
|
||
|
gdk::Paintable,
|
||
|
glib::*,
|
||
|
ApplicationWindow,
|
||
|
HeaderBar,
|
||
|
Button,
|
||
|
Window,
|
||
|
Popover,
|
||
|
Builder,
|
||
|
IconTheme,
|
||
|
IconLookupFlags,
|
||
|
TextDirection,
|
||
|
MenuButton,
|
||
|
TextView,
|
||
|
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));
|
||
|
}
|
||
|
}
|