1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// Take a look at the license at the top of the repository in the LICENSE file.

use crate::CellRendererPixbuf;
use crate::IconSize;
use glib::object::{IsA, ObjectExt};
use glib::translate::*;

pub trait CellRendererPixbufExtManual: 'static {
    /// The [`IconSize`][crate::IconSize] value that specifies the size of the rendered icon.
    #[doc(alias = "get_property_stock_size")]
    fn stock_size(&self) -> IconSize;

    /// The [`IconSize`][crate::IconSize] value that specifies the size of the rendered icon.
    fn set_stock_size(&self, stock_size: IconSize);
}

impl<O: IsA<CellRendererPixbuf> + IsA<glib::object::Object>> CellRendererPixbufExtManual for O {
    fn stock_size(&self) -> IconSize {
        unsafe { from_glib(self.property::<u32>("stock-size") as i32) }
    }

    fn set_stock_size(&self, stock_size: IconSize) {
        self.set_property("stock-size", stock_size.into_glib() as u32);
    }
}