This repository has been archived on 2025-03-27. You can view files and clone it, but cannot push or open issues or pull requests.
AIT/src/model/models.rs

47 lines
947 B
Rust
Raw Normal View History

use std::cell::Cell;
use crate::gtk;
use glib::Properties;
use gtk::glib;
use gtk::prelude::*;
use gtk::subclass::prelude::*;
2024-07-19 22:05:55 +03:00
#[repr(usize)]
#[derive(Clone)]
pub enum HammingMode {
Encrypt = 4,
Decrypt = 7,
}
pub struct EventHandler<F, C> {
pub(crate) component: C,
pub(crate) callback: F,
}
#[derive(Default, Copy, Clone)]
pub struct SignalReduce(pub f64, pub f64, pub f64, pub f64, pub f64, pub f64);
impl SignalReduce {
pub fn new() -> Self {
Self(0.0, 0.0, 0.0, 0.0, 0.0, 0.0)
}
}
#[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 {}