1use atk_sys;
6use glib::translate::*;
7use std::fmt;
8
9#[derive(Debug)]
10pub struct TextRectangle {
11 pub x: i32,
12 pub y: i32,
13 pub width: i32,
14 pub height: i32,
15}
16
17impl TextRectangle {
18 pub fn uninitialized() -> Self {
19 TextRectangle {
20 x: 0,
21 y: 0,
22 width: 0,
23 height: 0,
24 }
25 }
26
27 #[doc(hidden)]
28 #[inline]
29 pub fn to_glib_none_mut(&mut self) -> (*mut atk_sys::AtkTextRectangle, i32) {
30 (self as *mut TextRectangle as usize as *mut _, 0)
31 }
32}
33
34impl fmt::Display for TextRectangle {
35 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
36 f.debug_struct("TextRectangle")
37 .field("x", &self.x)
38 .field("y", &self.y)
39 .field("width", &self.width)
40 .field("height", &self.height)
41 .finish()
42 }
43}
44
45#[doc(hidden)]
46impl FromGlib<atk_sys::AtkTextRectangle> for TextRectangle {
47 fn from_glib(value: atk_sys::AtkTextRectangle) -> Self {
48 skip_assert_initialized!();
49 TextRectangle {
50 x: value.x,
51 y: value.y,
52 width: value.width,
53 height: value.height,
54 }
55 }
56}
57
58#[doc(hidden)]
59impl ToGlib for TextRectangle {
60 type GlibType = atk_sys::AtkTextRectangle;
61
62 fn to_glib(&self) -> atk_sys::AtkTextRectangle {
63 atk_sys::AtkTextRectangle {
64 x: self.x,
65 y: self.y,
66 width: self.width,
67 height: self.height,
68 }
69 }
70}