boostcontroller/src/window.rs
2024-10-24 01:16:53 +07:00

69 lines
2.3 KiB
Rust

/* window.rs
*
* Copyright 2024 Late Night Defender
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/
use gtk::prelude::*;
use adw::subclass::prelude::*;
use gtk::{gio, glib};
mod imp {
use super::*;
#[derive(Debug, Default, gtk::CompositeTemplate)]
#[template(resource = "/org/techtransthai/BoostController/window.ui")]
pub struct BoostcontrollerWindow {
// Template widgets
#[template_child]
pub label: TemplateChild<gtk::Label>,
}
#[glib::object_subclass]
impl ObjectSubclass for BoostcontrollerWindow {
const NAME: &'static str = "BoostcontrollerWindow";
type Type = super::BoostcontrollerWindow;
type ParentType = adw::ApplicationWindow;
fn class_init(klass: &mut Self::Class) {
klass.bind_template();
}
fn instance_init(obj: &glib::subclass::InitializingObject<Self>) {
obj.init_template();
}
}
impl ObjectImpl for BoostcontrollerWindow {}
impl WidgetImpl for BoostcontrollerWindow {}
impl WindowImpl for BoostcontrollerWindow {}
impl ApplicationWindowImpl for BoostcontrollerWindow {}
impl AdwApplicationWindowImpl for BoostcontrollerWindow {}
}
glib::wrapper! {
pub struct BoostcontrollerWindow(ObjectSubclass<imp::BoostcontrollerWindow>)
@extends gtk::Widget, gtk::Window, gtk::ApplicationWindow, adw::ApplicationWindow, @implements gio::ActionGroup, gio::ActionMap;
}
impl BoostcontrollerWindow {
pub fn new<P: IsA<gtk::Application>>(application: &P) -> Self {
glib::Object::builder()
.property("application", application)
.build()
}
}