feat(model): add model for ColumnView
Added model that are GObject for generating values in tables.
This commit is contained in:
parent
ade98179f7
commit
d3787b2283
|
@ -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()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -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 {}
|
||||||
|
|
Loading…
Reference in New Issue