gtk4/auto/
constant_expression.rs

1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from gir-files (https://github.com/gtk-rs/gir-files)
3// DO NOT EDIT
4
5use crate::ffi;
6use glib::{prelude::*, translate::*};
7
8glib::wrapper! {
9    #[doc(alias = "GtkConstantExpression")]
10    pub struct ConstantExpression(Shared<ffi::GtkConstantExpression>);
11
12    match fn {
13        ref => |ptr| ffi::gtk_expression_ref(ptr as *mut ffi::GtkExpression),
14        unref => |ptr| ffi::gtk_expression_unref(ptr as *mut ffi::GtkExpression),
15    }
16}
17
18impl StaticType for ConstantExpression {
19    fn static_type() -> glib::Type {
20        unsafe { from_glib(ffi::gtk_constant_expression_get_type()) }
21    }
22}
23
24impl ConstantExpression {
25    #[doc(alias = "gtk_constant_expression_new_for_value")]
26    #[doc(alias = "new_for_value")]
27    pub fn for_value(value: &glib::Value) -> ConstantExpression {
28        assert_initialized_main_thread!();
29        unsafe {
30            from_glib_full(ffi::gtk_constant_expression_new_for_value(
31                value.to_glib_none().0,
32            ))
33        }
34    }
35
36    #[doc(alias = "gtk_constant_expression_get_value")]
37    #[doc(alias = "get_value")]
38    pub fn value(&self) -> glib::Value {
39        unsafe {
40            from_glib_none(ffi::gtk_constant_expression_get_value(
41                self.to_glib_none().0,
42            ))
43        }
44    }
45}