mirror of
https://github.com/Xetibo/ReSet.git
synced 2025-04-12 08:28:32 +02:00
feat: Add popup
This commit is contained in:
parent
616792eaad
commit
5575acf00f
|
@ -2,3 +2,5 @@ pub mod settingBox;
|
|||
pub mod settingBoxImpl;
|
||||
pub mod listEntry;
|
||||
pub mod listEntryImpl;
|
||||
pub mod popup;
|
||||
pub mod popupImpl;
|
||||
|
|
19
src/components/base/popup.rs
Normal file
19
src/components/base/popup.rs
Normal file
|
@ -0,0 +1,19 @@
|
|||
use adw::glib;
|
||||
use adw::glib::{IsA, Object};
|
||||
use gtk::Widget;
|
||||
|
||||
use super::popupImpl;
|
||||
|
||||
glib::wrapper! {
|
||||
pub struct Popup(ObjectSubclass<popupImpl::Popup>)
|
||||
@extends adw::Window, gtk::Widget,
|
||||
@implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget, gtk::Orientable;
|
||||
}
|
||||
|
||||
impl Popup {
|
||||
pub fn new(child: &impl IsA<Widget>) -> Self {
|
||||
let popup: Popup = Object::builder().build();
|
||||
// popup.set_child(child);
|
||||
popup
|
||||
}
|
||||
}
|
41
src/components/base/popupImpl.rs
Normal file
41
src/components/base/popupImpl.rs
Normal file
|
@ -0,0 +1,41 @@
|
|||
use adw::subclass::window::AdwWindowImpl;
|
||||
use gtk::subclass::prelude::*;
|
||||
use gtk::{glib, CompositeTemplate};
|
||||
|
||||
use super::popup;
|
||||
|
||||
#[allow(non_snake_case)]
|
||||
#[derive(Default, CompositeTemplate)]
|
||||
#[template(resource = "/org/Xetibo/ReSet/resetPopup.ui")]
|
||||
pub struct Popup {}
|
||||
|
||||
#[glib::object_subclass]
|
||||
impl ObjectSubclass for Popup {
|
||||
const NAME: &'static str = "resetPopup";
|
||||
type Type = popup::Popup;
|
||||
type ParentType = adw::Window;
|
||||
|
||||
fn class_init(klass: &mut Self::Class) {
|
||||
klass.bind_template();
|
||||
}
|
||||
|
||||
fn instance_init(obj: &glib::subclass::InitializingObject<Self>) {
|
||||
obj.init_template();
|
||||
}
|
||||
}
|
||||
|
||||
impl ObjectImpl for Popup {
|
||||
fn constructed(&self) {
|
||||
self.parent_constructed();
|
||||
}
|
||||
}
|
||||
|
||||
impl BoxImpl for Popup {}
|
||||
|
||||
impl WidgetImpl for Popup {}
|
||||
|
||||
impl AdwWindowImpl for Popup {}
|
||||
|
||||
impl WindowImpl for Popup {}
|
||||
|
||||
impl ApplicationWindowImpl for Popup {}
|
Loading…
Reference in a new issue