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 
5 use glib::object::Cast;
6 use glib::object::IsA;
7 use glib::signal::connect_raw;
8 use glib::signal::SignalHandlerId;
9 use glib::translate::*;
10 use glib::StaticType;
11 use glib::Value;
12 use glib_sys;
13 use gobject_sys;
14 use gtk_sys;
15 use std::boxed::Box as Box_;
16 use std::fmt;
17 use std::mem;
18 use std::mem::transmute;
19 use CellArea;
20 
21 glib_wrapper! {
22     pub struct CellAreaContext(Object<gtk_sys::GtkCellAreaContext, gtk_sys::GtkCellAreaContextClass, CellAreaContextClass>);
23 
24     match fn {
25         get_type => || gtk_sys::gtk_cell_area_context_get_type(),
26     }
27 }
28 
29 pub const NONE_CELL_AREA_CONTEXT: Option<&CellAreaContext> = None;
30 
31 pub trait CellAreaContextExt: 'static {
allocate(&self, width: i32, height: i32)32     fn allocate(&self, width: i32, height: i32);
33 
get_allocation(&self) -> (i32, i32)34     fn get_allocation(&self) -> (i32, i32);
35 
get_area(&self) -> Option<CellArea>36     fn get_area(&self) -> Option<CellArea>;
37 
get_preferred_height(&self) -> (i32, i32)38     fn get_preferred_height(&self) -> (i32, i32);
39 
get_preferred_height_for_width(&self, width: i32) -> (i32, i32)40     fn get_preferred_height_for_width(&self, width: i32) -> (i32, i32);
41 
get_preferred_width(&self) -> (i32, i32)42     fn get_preferred_width(&self) -> (i32, i32);
43 
get_preferred_width_for_height(&self, height: i32) -> (i32, i32)44     fn get_preferred_width_for_height(&self, height: i32) -> (i32, i32);
45 
push_preferred_height(&self, minimum_height: i32, natural_height: i32)46     fn push_preferred_height(&self, minimum_height: i32, natural_height: i32);
47 
push_preferred_width(&self, minimum_width: i32, natural_width: i32)48     fn push_preferred_width(&self, minimum_width: i32, natural_width: i32);
49 
reset(&self)50     fn reset(&self);
51 
get_property_minimum_height(&self) -> i3252     fn get_property_minimum_height(&self) -> i32;
53 
get_property_minimum_width(&self) -> i3254     fn get_property_minimum_width(&self) -> i32;
55 
get_property_natural_height(&self) -> i3256     fn get_property_natural_height(&self) -> i32;
57 
get_property_natural_width(&self) -> i3258     fn get_property_natural_width(&self) -> i32;
59 
connect_property_minimum_height_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId60     fn connect_property_minimum_height_notify<F: Fn(&Self) + 'static>(
61         &self,
62         f: F,
63     ) -> SignalHandlerId;
64 
connect_property_minimum_width_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId65     fn connect_property_minimum_width_notify<F: Fn(&Self) + 'static>(
66         &self,
67         f: F,
68     ) -> SignalHandlerId;
69 
connect_property_natural_height_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId70     fn connect_property_natural_height_notify<F: Fn(&Self) + 'static>(
71         &self,
72         f: F,
73     ) -> SignalHandlerId;
74 
connect_property_natural_width_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId75     fn connect_property_natural_width_notify<F: Fn(&Self) + 'static>(
76         &self,
77         f: F,
78     ) -> SignalHandlerId;
79 }
80 
81 impl<O: IsA<CellAreaContext>> CellAreaContextExt for O {
allocate(&self, width: i32, height: i32)82     fn allocate(&self, width: i32, height: i32) {
83         unsafe {
84             gtk_sys::gtk_cell_area_context_allocate(self.as_ref().to_glib_none().0, width, height);
85         }
86     }
87 
get_allocation(&self) -> (i32, i32)88     fn get_allocation(&self) -> (i32, i32) {
89         unsafe {
90             let mut width = mem::MaybeUninit::uninit();
91             let mut height = mem::MaybeUninit::uninit();
92             gtk_sys::gtk_cell_area_context_get_allocation(
93                 self.as_ref().to_glib_none().0,
94                 width.as_mut_ptr(),
95                 height.as_mut_ptr(),
96             );
97             let width = width.assume_init();
98             let height = height.assume_init();
99             (width, height)
100         }
101     }
102 
get_area(&self) -> Option<CellArea>103     fn get_area(&self) -> Option<CellArea> {
104         unsafe {
105             from_glib_none(gtk_sys::gtk_cell_area_context_get_area(
106                 self.as_ref().to_glib_none().0,
107             ))
108         }
109     }
110 
get_preferred_height(&self) -> (i32, i32)111     fn get_preferred_height(&self) -> (i32, i32) {
112         unsafe {
113             let mut minimum_height = mem::MaybeUninit::uninit();
114             let mut natural_height = mem::MaybeUninit::uninit();
115             gtk_sys::gtk_cell_area_context_get_preferred_height(
116                 self.as_ref().to_glib_none().0,
117                 minimum_height.as_mut_ptr(),
118                 natural_height.as_mut_ptr(),
119             );
120             let minimum_height = minimum_height.assume_init();
121             let natural_height = natural_height.assume_init();
122             (minimum_height, natural_height)
123         }
124     }
125 
get_preferred_height_for_width(&self, width: i32) -> (i32, i32)126     fn get_preferred_height_for_width(&self, width: i32) -> (i32, i32) {
127         unsafe {
128             let mut minimum_height = mem::MaybeUninit::uninit();
129             let mut natural_height = mem::MaybeUninit::uninit();
130             gtk_sys::gtk_cell_area_context_get_preferred_height_for_width(
131                 self.as_ref().to_glib_none().0,
132                 width,
133                 minimum_height.as_mut_ptr(),
134                 natural_height.as_mut_ptr(),
135             );
136             let minimum_height = minimum_height.assume_init();
137             let natural_height = natural_height.assume_init();
138             (minimum_height, natural_height)
139         }
140     }
141 
get_preferred_width(&self) -> (i32, i32)142     fn get_preferred_width(&self) -> (i32, i32) {
143         unsafe {
144             let mut minimum_width = mem::MaybeUninit::uninit();
145             let mut natural_width = mem::MaybeUninit::uninit();
146             gtk_sys::gtk_cell_area_context_get_preferred_width(
147                 self.as_ref().to_glib_none().0,
148                 minimum_width.as_mut_ptr(),
149                 natural_width.as_mut_ptr(),
150             );
151             let minimum_width = minimum_width.assume_init();
152             let natural_width = natural_width.assume_init();
153             (minimum_width, natural_width)
154         }
155     }
156 
get_preferred_width_for_height(&self, height: i32) -> (i32, i32)157     fn get_preferred_width_for_height(&self, height: i32) -> (i32, i32) {
158         unsafe {
159             let mut minimum_width = mem::MaybeUninit::uninit();
160             let mut natural_width = mem::MaybeUninit::uninit();
161             gtk_sys::gtk_cell_area_context_get_preferred_width_for_height(
162                 self.as_ref().to_glib_none().0,
163                 height,
164                 minimum_width.as_mut_ptr(),
165                 natural_width.as_mut_ptr(),
166             );
167             let minimum_width = minimum_width.assume_init();
168             let natural_width = natural_width.assume_init();
169             (minimum_width, natural_width)
170         }
171     }
172 
push_preferred_height(&self, minimum_height: i32, natural_height: i32)173     fn push_preferred_height(&self, minimum_height: i32, natural_height: i32) {
174         unsafe {
175             gtk_sys::gtk_cell_area_context_push_preferred_height(
176                 self.as_ref().to_glib_none().0,
177                 minimum_height,
178                 natural_height,
179             );
180         }
181     }
182 
push_preferred_width(&self, minimum_width: i32, natural_width: i32)183     fn push_preferred_width(&self, minimum_width: i32, natural_width: i32) {
184         unsafe {
185             gtk_sys::gtk_cell_area_context_push_preferred_width(
186                 self.as_ref().to_glib_none().0,
187                 minimum_width,
188                 natural_width,
189             );
190         }
191     }
192 
reset(&self)193     fn reset(&self) {
194         unsafe {
195             gtk_sys::gtk_cell_area_context_reset(self.as_ref().to_glib_none().0);
196         }
197     }
198 
get_property_minimum_height(&self) -> i32199     fn get_property_minimum_height(&self) -> i32 {
200         unsafe {
201             let mut value = Value::from_type(<i32 as StaticType>::static_type());
202             gobject_sys::g_object_get_property(
203                 self.to_glib_none().0 as *mut gobject_sys::GObject,
204                 b"minimum-height\0".as_ptr() as *const _,
205                 value.to_glib_none_mut().0,
206             );
207             value
208                 .get()
209                 .expect("Return Value for property `minimum-height` getter")
210                 .unwrap()
211         }
212     }
213 
get_property_minimum_width(&self) -> i32214     fn get_property_minimum_width(&self) -> i32 {
215         unsafe {
216             let mut value = Value::from_type(<i32 as StaticType>::static_type());
217             gobject_sys::g_object_get_property(
218                 self.to_glib_none().0 as *mut gobject_sys::GObject,
219                 b"minimum-width\0".as_ptr() as *const _,
220                 value.to_glib_none_mut().0,
221             );
222             value
223                 .get()
224                 .expect("Return Value for property `minimum-width` getter")
225                 .unwrap()
226         }
227     }
228 
get_property_natural_height(&self) -> i32229     fn get_property_natural_height(&self) -> i32 {
230         unsafe {
231             let mut value = Value::from_type(<i32 as StaticType>::static_type());
232             gobject_sys::g_object_get_property(
233                 self.to_glib_none().0 as *mut gobject_sys::GObject,
234                 b"natural-height\0".as_ptr() as *const _,
235                 value.to_glib_none_mut().0,
236             );
237             value
238                 .get()
239                 .expect("Return Value for property `natural-height` getter")
240                 .unwrap()
241         }
242     }
243 
get_property_natural_width(&self) -> i32244     fn get_property_natural_width(&self) -> i32 {
245         unsafe {
246             let mut value = Value::from_type(<i32 as StaticType>::static_type());
247             gobject_sys::g_object_get_property(
248                 self.to_glib_none().0 as *mut gobject_sys::GObject,
249                 b"natural-width\0".as_ptr() as *const _,
250                 value.to_glib_none_mut().0,
251             );
252             value
253                 .get()
254                 .expect("Return Value for property `natural-width` getter")
255                 .unwrap()
256         }
257     }
258 
connect_property_minimum_height_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId259     fn connect_property_minimum_height_notify<F: Fn(&Self) + 'static>(
260         &self,
261         f: F,
262     ) -> SignalHandlerId {
263         unsafe extern "C" fn notify_minimum_height_trampoline<P, F: Fn(&P) + 'static>(
264             this: *mut gtk_sys::GtkCellAreaContext,
265             _param_spec: glib_sys::gpointer,
266             f: glib_sys::gpointer,
267         ) where
268             P: IsA<CellAreaContext>,
269         {
270             let f: &F = &*(f as *const F);
271             f(&CellAreaContext::from_glib_borrow(this).unsafe_cast())
272         }
273         unsafe {
274             let f: Box_<F> = Box_::new(f);
275             connect_raw(
276                 self.as_ptr() as *mut _,
277                 b"notify::minimum-height\0".as_ptr() as *const _,
278                 Some(transmute(
279                     notify_minimum_height_trampoline::<Self, F> as usize,
280                 )),
281                 Box_::into_raw(f),
282             )
283         }
284     }
285 
connect_property_minimum_width_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId286     fn connect_property_minimum_width_notify<F: Fn(&Self) + 'static>(
287         &self,
288         f: F,
289     ) -> SignalHandlerId {
290         unsafe extern "C" fn notify_minimum_width_trampoline<P, F: Fn(&P) + 'static>(
291             this: *mut gtk_sys::GtkCellAreaContext,
292             _param_spec: glib_sys::gpointer,
293             f: glib_sys::gpointer,
294         ) where
295             P: IsA<CellAreaContext>,
296         {
297             let f: &F = &*(f as *const F);
298             f(&CellAreaContext::from_glib_borrow(this).unsafe_cast())
299         }
300         unsafe {
301             let f: Box_<F> = Box_::new(f);
302             connect_raw(
303                 self.as_ptr() as *mut _,
304                 b"notify::minimum-width\0".as_ptr() as *const _,
305                 Some(transmute(
306                     notify_minimum_width_trampoline::<Self, F> as usize,
307                 )),
308                 Box_::into_raw(f),
309             )
310         }
311     }
312 
connect_property_natural_height_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId313     fn connect_property_natural_height_notify<F: Fn(&Self) + 'static>(
314         &self,
315         f: F,
316     ) -> SignalHandlerId {
317         unsafe extern "C" fn notify_natural_height_trampoline<P, F: Fn(&P) + 'static>(
318             this: *mut gtk_sys::GtkCellAreaContext,
319             _param_spec: glib_sys::gpointer,
320             f: glib_sys::gpointer,
321         ) where
322             P: IsA<CellAreaContext>,
323         {
324             let f: &F = &*(f as *const F);
325             f(&CellAreaContext::from_glib_borrow(this).unsafe_cast())
326         }
327         unsafe {
328             let f: Box_<F> = Box_::new(f);
329             connect_raw(
330                 self.as_ptr() as *mut _,
331                 b"notify::natural-height\0".as_ptr() as *const _,
332                 Some(transmute(
333                     notify_natural_height_trampoline::<Self, F> as usize,
334                 )),
335                 Box_::into_raw(f),
336             )
337         }
338     }
339 
connect_property_natural_width_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId340     fn connect_property_natural_width_notify<F: Fn(&Self) + 'static>(
341         &self,
342         f: F,
343     ) -> SignalHandlerId {
344         unsafe extern "C" fn notify_natural_width_trampoline<P, F: Fn(&P) + 'static>(
345             this: *mut gtk_sys::GtkCellAreaContext,
346             _param_spec: glib_sys::gpointer,
347             f: glib_sys::gpointer,
348         ) where
349             P: IsA<CellAreaContext>,
350         {
351             let f: &F = &*(f as *const F);
352             f(&CellAreaContext::from_glib_borrow(this).unsafe_cast())
353         }
354         unsafe {
355             let f: Box_<F> = Box_::new(f);
356             connect_raw(
357                 self.as_ptr() as *mut _,
358                 b"notify::natural-width\0".as_ptr() as *const _,
359                 Some(transmute(
360                     notify_natural_width_trampoline::<Self, F> as usize,
361                 )),
362                 Box_::into_raw(f),
363             )
364         }
365     }
366 }
367 
368 impl fmt::Display for CellAreaContext {
fmt(&self, f: &mut fmt::Formatter) -> fmt::Result369     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
370         write!(f, "CellAreaContext")
371     }
372 }
373