57 lines
1.1 KiB
Rust
57 lines
1.1 KiB
Rust
|
|
use cascade::cascade;
|
||
|
|
use gtk4::{
|
||
|
|
glib,
|
||
|
|
prelude::*,
|
||
|
|
subclass::prelude::*,
|
||
|
|
};
|
||
|
|
|
||
|
|
use crate::deref_cell::DerefCell;
|
||
|
|
|
||
|
|
#[derive(Default)]
|
||
|
|
pub struct StatusAreaInner {
|
||
|
|
box_: DerefCell<gtk4::Box>,
|
||
|
|
}
|
||
|
|
|
||
|
|
#[glib::object_subclass]
|
||
|
|
impl ObjectSubclass for StatusAreaInner {
|
||
|
|
const NAME: &'static str = "S76StatusArea";
|
||
|
|
type ParentType = gtk4::Widget;
|
||
|
|
type Type = StatusArea;
|
||
|
|
|
||
|
|
fn class_init(klass: &mut Self::Class) {
|
||
|
|
klass.set_layout_manager_type::<gtk4::BinLayout>();
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
impl ObjectImpl for StatusAreaInner {
|
||
|
|
fn constructed(&self, obj: &StatusArea) {
|
||
|
|
let box_ = cascade! {
|
||
|
|
gtk4::Box::new(gtk4::Orientation::Horizontal, 0);
|
||
|
|
..set_parent(obj);
|
||
|
|
};
|
||
|
|
|
||
|
|
self.box_.set(box_);
|
||
|
|
}
|
||
|
|
|
||
|
|
fn dispose(&self, _obj: &StatusArea) {
|
||
|
|
self.box_.unparent();
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
impl WidgetImpl for StatusAreaInner {}
|
||
|
|
|
||
|
|
glib::wrapper! {
|
||
|
|
pub struct StatusArea(ObjectSubclass<StatusAreaInner>)
|
||
|
|
@extends gtk4::Widget;
|
||
|
|
}
|
||
|
|
|
||
|
|
impl StatusArea {
|
||
|
|
pub fn new() -> Self {
|
||
|
|
glib::Object::new(&[]).unwrap()
|
||
|
|
}
|
||
|
|
|
||
|
|
fn inner(&self) -> &StatusAreaInner {
|
||
|
|
StatusAreaInner::from_instance(self)
|
||
|
|
}
|
||
|
|
}
|