feat(model): add model for ColumnView

Added model that are GObject for generating values in tables.
This commit is contained in:
doryan 2024-08-02 01:09:26 +04:00
parent ade98179f7
commit d3787b2283
2 changed files with 39 additions and 0 deletions

View File

@ -1,2 +1,15 @@
pub mod builder_traits; pub mod builder_traits;
pub mod models; pub mod models;
use crate::gtk::glib;
use glib::Object;
glib::wrapper! {
pub struct ResultValue(ObjectSubclass<models::ResultValue>);
}
impl ResultValue {
pub fn new(val: f64) -> Self {
Object::builder().property("value", val).build()
}
}

View File

@ -1,3 +1,12 @@
use std::cell::Cell;
use crate::gtk;
use glib::Properties;
use gtk::glib;
use gtk::prelude::*;
use gtk::subclass::prelude::*;
#[repr(usize)] #[repr(usize)]
#[derive(Clone)] #[derive(Clone)]
pub enum HammingMode { pub enum HammingMode {
@ -11,3 +20,20 @@ pub struct EventHandler<F, C> {
} }
pub type SchemeCharacteristics = (f64, f64, f64, f64, f64, f64); pub type SchemeCharacteristics = (f64, f64, f64, f64, f64, f64);
#[derive(Properties, Default)]
#[properties(wrapper_type = super::ResultValue)]
pub struct ResultValue {
#[property(get, set)]
value: Cell<f64>,
}
// The central trait for subclassing a GObject
#[glib::object_subclass]
impl ObjectSubclass for ResultValue {
const NAME: &'static str = "MyGtkAppCustomButton";
type Type = super::ResultValue;
}
#[glib::derived_properties]
impl ObjectImpl for ResultValue {}