1use crate::ffi;
4use glib::translate::*;
5use std::fmt;
6
7#[derive(Debug)]
9#[doc(alias = "AtkTextRectangle")]
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 Self {
20 x: 0,
21 y: 0,
22 width: 0,
23 height: 0,
24 }
25 }
26
27 #[doc(hidden)]
28 #[inline]
29 #[allow(clippy::wrong_self_convention)]
30 pub fn to_glib_none_mut(&mut self) -> (*mut ffi::AtkTextRectangle, i32) {
31 (self as *mut TextRectangle as usize as *mut _, 0)
32 }
33}
34
35impl fmt::Display for TextRectangle {
36 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
37 f.debug_struct("TextRectangle")
38 .field("x", &self.x)
39 .field("y", &self.y)
40 .field("width", &self.width)
41 .field("height", &self.height)
42 .finish()
43 }
44}
45
46#[doc(hidden)]
47impl FromGlib<ffi::AtkTextRectangle> for TextRectangle {
48 unsafe fn from_glib(value: ffi::AtkTextRectangle) -> Self {
49 skip_assert_initialized!();
50 Self {
51 x: value.x,
52 y: value.y,
53 width: value.width,
54 height: value.height,
55 }
56 }
57}
58
59#[doc(hidden)]
60impl IntoGlib for TextRectangle {
61 type GlibType = ffi::AtkTextRectangle;
62
63 fn into_glib(self) -> ffi::AtkTextRectangle {
64 ffi::AtkTextRectangle {
65 x: self.x,
66 y: self.y,
67 width: self.width,
68 height: self.height,
69 }
70 }
71}