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
// 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 Layout;
use LayoutLine;
use LayoutRun;
use Rectangle;
use ffi;
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),
        get_type => || ffi::pango_layout_iter_get_type(),
    }
}

impl LayoutIter {
    pub fn at_last_line(&mut self) -> bool {
        unsafe {
            from_glib(ffi::pango_layout_iter_at_last_line(self.to_glib_none_mut().0))
        }
    }

    pub fn get_baseline(&mut self) -> i32 {
        unsafe {
            ffi::pango_layout_iter_get_baseline(self.to_glib_none_mut().0)
        }
    }

    pub fn get_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
        }
    }

    pub fn get_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)
        }
    }

    pub fn get_index(&mut self) -> i32 {
        unsafe {
            ffi::pango_layout_iter_get_index(self.to_glib_none_mut().0)
        }
    }

    pub fn get_layout(&mut self) -> Option<Layout> {
        unsafe {
            from_glib_none(ffi::pango_layout_iter_get_layout(self.to_glib_none_mut().0))
        }
    }

    pub fn get_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)
        }
    }

    pub fn get_line(&mut self) -> Option<LayoutLine> {
        unsafe {
            from_glib_full(ffi::pango_layout_iter_get_line(self.to_glib_none_mut().0))
        }
    }

    pub fn get_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)
        }
    }

    pub fn get_line_readonly(&mut self) -> Option<LayoutLine> {
        unsafe {
            from_glib_none(ffi::pango_layout_iter_get_line_readonly(self.to_glib_none_mut().0))
        }
    }

    pub fn get_line_yrange(&mut self) -> (i32, i32) {
        unsafe {
            let mut y0_ = mem::uninitialized();
            let mut y1_ = mem::uninitialized();
            ffi::pango_layout_iter_get_line_yrange(self.to_glib_none_mut().0, &mut y0_, &mut y1_);
            (y0_, y1_)
        }
    }

    pub fn get_run(&mut self) -> Option<LayoutRun> {
        unsafe {
            from_glib_none(ffi::pango_layout_iter_get_run(self.to_glib_none_mut().0))
        }
    }

    pub fn get_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)
        }
    }

    pub fn get_run_readonly(&mut self) -> Option<LayoutRun> {
        unsafe {
            from_glib_none(ffi::pango_layout_iter_get_run_readonly(self.to_glib_none_mut().0))
        }
    }

    pub fn next_char(&mut self) -> bool {
        unsafe {
            from_glib(ffi::pango_layout_iter_next_char(self.to_glib_none_mut().0))
        }
    }

    pub fn next_cluster(&mut self) -> bool {
        unsafe {
            from_glib(ffi::pango_layout_iter_next_cluster(self.to_glib_none_mut().0))
        }
    }

    pub fn next_line(&mut self) -> bool {
        unsafe {
            from_glib(ffi::pango_layout_iter_next_line(self.to_glib_none_mut().0))
        }
    }

    pub fn next_run(&mut self) -> bool {
        unsafe {
            from_glib(ffi::pango_layout_iter_next_run(self.to_glib_none_mut().0))
        }
    }
}