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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT

use crate::Layout;
use crate::LayoutLine;
use crate::LayoutRun;
use crate::Rectangle;
use glib::translate::*;
use std::mem;

glib::wrapper! {
    #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
    pub struct LayoutIter(Boxed<ffi::PangoLayoutIter>);

    match fn {
        copy => |ptr| ffi::pango_layout_iter_copy(mut_override(ptr)),
        free => |ptr| ffi::pango_layout_iter_free(ptr),
        type_ => || ffi::pango_layout_iter_get_type(),
    }
}

impl LayoutIter {
    #[doc(alias = "pango_layout_iter_at_last_line")]
    pub fn at_last_line(&mut self) -> bool {
        unsafe {
            from_glib(ffi::pango_layout_iter_at_last_line(
                self.to_glib_none_mut().0,
            ))
        }
    }

    #[doc(alias = "pango_layout_iter_get_baseline")]
    #[doc(alias = "get_baseline")]
    pub fn baseline(&mut self) -> i32 {
        unsafe { ffi::pango_layout_iter_get_baseline(self.to_glib_none_mut().0) }
    }

    #[doc(alias = "pango_layout_iter_get_char_extents")]
    #[doc(alias = "get_char_extents")]
    pub fn char_extents(&mut self) -> Rectangle {
        unsafe {
            let mut logical_rect = Rectangle::uninitialized();
            ffi::pango_layout_iter_get_char_extents(
                self.to_glib_none_mut().0,
                logical_rect.to_glib_none_mut().0,
            );
            logical_rect
        }
    }

    #[doc(alias = "pango_layout_iter_get_cluster_extents")]
    #[doc(alias = "get_cluster_extents")]
    pub fn cluster_extents(&mut self) -> (Rectangle, Rectangle) {
        unsafe {
            let mut ink_rect = Rectangle::uninitialized();
            let mut logical_rect = Rectangle::uninitialized();
            ffi::pango_layout_iter_get_cluster_extents(
                self.to_glib_none_mut().0,
                ink_rect.to_glib_none_mut().0,
                logical_rect.to_glib_none_mut().0,
            );
            (ink_rect, logical_rect)
        }
    }

    #[doc(alias = "pango_layout_iter_get_index")]
    #[doc(alias = "get_index")]
    pub fn index(&mut self) -> i32 {
        unsafe { ffi::pango_layout_iter_get_index(self.to_glib_none_mut().0) }
    }

    #[doc(alias = "pango_layout_iter_get_layout")]
    #[doc(alias = "get_layout")]
    pub fn layout(&mut self) -> Option<Layout> {
        unsafe { from_glib_none(ffi::pango_layout_iter_get_layout(self.to_glib_none_mut().0)) }
    }

    #[doc(alias = "pango_layout_iter_get_layout_extents")]
    #[doc(alias = "get_layout_extents")]
    pub fn layout_extents(&mut self) -> (Rectangle, Rectangle) {
        unsafe {
            let mut ink_rect = Rectangle::uninitialized();
            let mut logical_rect = Rectangle::uninitialized();
            ffi::pango_layout_iter_get_layout_extents(
                self.to_glib_none_mut().0,
                ink_rect.to_glib_none_mut().0,
                logical_rect.to_glib_none_mut().0,
            );
            (ink_rect, logical_rect)
        }
    }

    #[doc(alias = "pango_layout_iter_get_line")]
    #[doc(alias = "get_line")]
    pub fn line(&mut self) -> Option<LayoutLine> {
        unsafe { from_glib_none(ffi::pango_layout_iter_get_line(self.to_glib_none_mut().0)) }
    }

    #[doc(alias = "pango_layout_iter_get_line_extents")]
    #[doc(alias = "get_line_extents")]
    pub fn line_extents(&mut self) -> (Rectangle, Rectangle) {
        unsafe {
            let mut ink_rect = Rectangle::uninitialized();
            let mut logical_rect = Rectangle::uninitialized();
            ffi::pango_layout_iter_get_line_extents(
                self.to_glib_none_mut().0,
                ink_rect.to_glib_none_mut().0,
                logical_rect.to_glib_none_mut().0,
            );
            (ink_rect, logical_rect)
        }
    }

    #[doc(alias = "pango_layout_iter_get_line_readonly")]
    #[doc(alias = "get_line_readonly")]
    pub fn line_readonly(&mut self) -> Option<LayoutLine> {
        unsafe {
            from_glib_none(ffi::pango_layout_iter_get_line_readonly(
                self.to_glib_none_mut().0,
            ))
        }
    }

    #[doc(alias = "pango_layout_iter_get_line_yrange")]
    #[doc(alias = "get_line_yrange")]
    pub fn line_yrange(&mut self) -> (i32, i32) {
        unsafe {
            let mut y0_ = mem::MaybeUninit::uninit();
            let mut y1_ = mem::MaybeUninit::uninit();
            ffi::pango_layout_iter_get_line_yrange(
                self.to_glib_none_mut().0,
                y0_.as_mut_ptr(),
                y1_.as_mut_ptr(),
            );
            let y0_ = y0_.assume_init();
            let y1_ = y1_.assume_init();
            (y0_, y1_)
        }
    }

    #[doc(alias = "pango_layout_iter_get_run")]
    #[doc(alias = "get_run")]
    pub fn run(&mut self) -> Option<LayoutRun> {
        unsafe { from_glib_none(ffi::pango_layout_iter_get_run(self.to_glib_none_mut().0)) }
    }

    #[cfg(any(feature = "v1_50", feature = "dox"))]
    #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_50")))]
    #[doc(alias = "pango_layout_iter_get_run_baseline")]
    #[doc(alias = "get_run_baseline")]
    pub fn run_baseline(&mut self) -> i32 {
        unsafe { ffi::pango_layout_iter_get_run_baseline(self.to_glib_none_mut().0) }
    }

    #[doc(alias = "pango_layout_iter_get_run_extents")]
    #[doc(alias = "get_run_extents")]
    pub fn run_extents(&mut self) -> (Rectangle, Rectangle) {
        unsafe {
            let mut ink_rect = Rectangle::uninitialized();
            let mut logical_rect = Rectangle::uninitialized();
            ffi::pango_layout_iter_get_run_extents(
                self.to_glib_none_mut().0,
                ink_rect.to_glib_none_mut().0,
                logical_rect.to_glib_none_mut().0,
            );
            (ink_rect, logical_rect)
        }
    }

    #[doc(alias = "pango_layout_iter_get_run_readonly")]
    #[doc(alias = "get_run_readonly")]
    pub fn run_readonly(&mut self) -> Option<LayoutRun> {
        unsafe {
            from_glib_none(ffi::pango_layout_iter_get_run_readonly(
                self.to_glib_none_mut().0,
            ))
        }
    }

    #[doc(alias = "pango_layout_iter_next_char")]
    pub fn next_char(&mut self) -> bool {
        unsafe { from_glib(ffi::pango_layout_iter_next_char(self.to_glib_none_mut().0)) }
    }

    #[doc(alias = "pango_layout_iter_next_cluster")]
    pub fn next_cluster(&mut self) -> bool {
        unsafe {
            from_glib(ffi::pango_layout_iter_next_cluster(
                self.to_glib_none_mut().0,
            ))
        }
    }

    #[doc(alias = "pango_layout_iter_next_line")]
    pub fn next_line(&mut self) -> bool {
        unsafe { from_glib(ffi::pango_layout_iter_next_line(self.to_glib_none_mut().0)) }
    }

    #[doc(alias = "pango_layout_iter_next_run")]
    pub fn next_run(&mut self) -> bool {
        unsafe { from_glib(ffi::pango_layout_iter_next_run(self.to_glib_none_mut().0)) }
    }
}