summaryrefslogtreecommitdiff
path: root/schist_gtk4_gui/src/window.rs
diff options
context:
space:
mode:
Diffstat (limited to 'schist_gtk4_gui/src/window.rs')
-rw-r--r--schist_gtk4_gui/src/window.rs61
1 files changed, 61 insertions, 0 deletions
diff --git a/schist_gtk4_gui/src/window.rs b/schist_gtk4_gui/src/window.rs
new file mode 100644
index 0000000..b1ca9f6
--- /dev/null
+++ b/schist_gtk4_gui/src/window.rs
@@ -0,0 +1,61 @@
+use gtk::{
+ gio,
+ glib::{
+ self,
+ object::IsA,
+ subclass::{
+ object::{ObjectImpl, ObjectImplExt},
+ types::ObjectSubclass,
+ InitializingObject,
+ },
+ },
+ subclass::{
+ application_window::ApplicationWindowImpl,
+ widget::{CompositeTemplateClass, CompositeTemplateInitializingExt, WidgetImpl},
+ window::WindowImpl,
+ },
+};
+
+gtk::glib::wrapper! {
+ pub struct SchistWindow(ObjectSubclass<SchistWindowSubclass>)
+ @extends gtk::ApplicationWindow, gtk::Window, gtk::Widget,
+ @implements gio::ActionGroup, gio::ActionMap, gtk::Accessible, gtk::Buildable,
+ gtk::ConstraintTarget, gtk::Native, gtk::Root, gtk::ShortcutManager;
+}
+
+impl SchistWindow {
+ pub fn new<A: IsA<gtk::Application>>(app: &A) -> Self {
+ glib::Object::builder().property("application", app).build()
+ }
+}
+
+#[derive(gtk::CompositeTemplate, Default)]
+#[template(resource = "/net/joeac/schist/window.ui")]
+pub struct SchistWindowSubclass {}
+
+#[glib::object_subclass]
+impl ObjectSubclass for SchistWindowSubclass {
+ const NAME: &'static str = "SchistWindow";
+ type Type = SchistWindow;
+ type ParentType = gtk::ApplicationWindow;
+
+ fn class_init(klass: &mut Self::Class) {
+ klass.bind_template();
+ }
+
+ fn instance_init(obj: &InitializingObject<Self>) {
+ obj.init_template();
+ }
+}
+
+impl ObjectImpl for SchistWindowSubclass {
+ fn constructed(&self) {
+ self.parent_constructed();
+ }
+}
+
+impl WidgetImpl for SchistWindowSubclass {}
+
+impl WindowImpl for SchistWindowSubclass {}
+
+impl ApplicationWindowImpl for SchistWindowSubclass {}