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 crate::Layout; 6 use crate::LayoutLine; 7 use crate::LayoutRun; 8 use crate::Rectangle; 9 use glib::translate::*; 10 use std::mem; 11 12 glib::wrapper! { 13 #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] 14 pub struct LayoutIter(Boxed<ffi::PangoLayoutIter>); 15 16 match fn { 17 copy => |ptr| ffi::pango_layout_iter_copy(mut_override(ptr)), 18 free => |ptr| ffi::pango_layout_iter_free(ptr), 19 type_ => || ffi::pango_layout_iter_get_type(), 20 } 21 } 22 23 impl LayoutIter { 24 #[doc(alias = "pango_layout_iter_at_last_line")] at_last_line(&mut self) -> bool25 pub fn at_last_line(&mut self) -> bool { 26 unsafe { 27 from_glib(ffi::pango_layout_iter_at_last_line( 28 self.to_glib_none_mut().0, 29 )) 30 } 31 } 32 33 #[doc(alias = "pango_layout_iter_get_baseline")] 34 #[doc(alias = "get_baseline")] baseline(&mut self) -> i3235 pub fn baseline(&mut self) -> i32 { 36 unsafe { ffi::pango_layout_iter_get_baseline(self.to_glib_none_mut().0) } 37 } 38 39 #[doc(alias = "pango_layout_iter_get_char_extents")] 40 #[doc(alias = "get_char_extents")] char_extents(&mut self) -> Rectangle41 pub fn char_extents(&mut self) -> Rectangle { 42 unsafe { 43 let mut logical_rect = Rectangle::uninitialized(); 44 ffi::pango_layout_iter_get_char_extents( 45 self.to_glib_none_mut().0, 46 logical_rect.to_glib_none_mut().0, 47 ); 48 logical_rect 49 } 50 } 51 52 #[doc(alias = "pango_layout_iter_get_cluster_extents")] 53 #[doc(alias = "get_cluster_extents")] cluster_extents(&mut self) -> (Rectangle, Rectangle)54 pub fn cluster_extents(&mut self) -> (Rectangle, Rectangle) { 55 unsafe { 56 let mut ink_rect = Rectangle::uninitialized(); 57 let mut logical_rect = Rectangle::uninitialized(); 58 ffi::pango_layout_iter_get_cluster_extents( 59 self.to_glib_none_mut().0, 60 ink_rect.to_glib_none_mut().0, 61 logical_rect.to_glib_none_mut().0, 62 ); 63 (ink_rect, logical_rect) 64 } 65 } 66 67 #[doc(alias = "pango_layout_iter_get_index")] 68 #[doc(alias = "get_index")] index(&mut self) -> i3269 pub fn index(&mut self) -> i32 { 70 unsafe { ffi::pango_layout_iter_get_index(self.to_glib_none_mut().0) } 71 } 72 73 #[doc(alias = "pango_layout_iter_get_layout")] 74 #[doc(alias = "get_layout")] layout(&mut self) -> Option<Layout>75 pub fn layout(&mut self) -> Option<Layout> { 76 unsafe { from_glib_none(ffi::pango_layout_iter_get_layout(self.to_glib_none_mut().0)) } 77 } 78 79 #[doc(alias = "pango_layout_iter_get_layout_extents")] 80 #[doc(alias = "get_layout_extents")] layout_extents(&mut self) -> (Rectangle, Rectangle)81 pub fn layout_extents(&mut self) -> (Rectangle, Rectangle) { 82 unsafe { 83 let mut ink_rect = Rectangle::uninitialized(); 84 let mut logical_rect = Rectangle::uninitialized(); 85 ffi::pango_layout_iter_get_layout_extents( 86 self.to_glib_none_mut().0, 87 ink_rect.to_glib_none_mut().0, 88 logical_rect.to_glib_none_mut().0, 89 ); 90 (ink_rect, logical_rect) 91 } 92 } 93 94 #[doc(alias = "pango_layout_iter_get_line")] 95 #[doc(alias = "get_line")] line(&mut self) -> Option<LayoutLine>96 pub fn line(&mut self) -> Option<LayoutLine> { 97 unsafe { from_glib_none(ffi::pango_layout_iter_get_line(self.to_glib_none_mut().0)) } 98 } 99 100 #[doc(alias = "pango_layout_iter_get_line_extents")] 101 #[doc(alias = "get_line_extents")] line_extents(&mut self) -> (Rectangle, Rectangle)102 pub fn line_extents(&mut self) -> (Rectangle, Rectangle) { 103 unsafe { 104 let mut ink_rect = Rectangle::uninitialized(); 105 let mut logical_rect = Rectangle::uninitialized(); 106 ffi::pango_layout_iter_get_line_extents( 107 self.to_glib_none_mut().0, 108 ink_rect.to_glib_none_mut().0, 109 logical_rect.to_glib_none_mut().0, 110 ); 111 (ink_rect, logical_rect) 112 } 113 } 114 115 #[doc(alias = "pango_layout_iter_get_line_readonly")] 116 #[doc(alias = "get_line_readonly")] line_readonly(&mut self) -> Option<LayoutLine>117 pub fn line_readonly(&mut self) -> Option<LayoutLine> { 118 unsafe { 119 from_glib_none(ffi::pango_layout_iter_get_line_readonly( 120 self.to_glib_none_mut().0, 121 )) 122 } 123 } 124 125 #[doc(alias = "pango_layout_iter_get_line_yrange")] 126 #[doc(alias = "get_line_yrange")] line_yrange(&mut self) -> (i32, i32)127 pub fn line_yrange(&mut self) -> (i32, i32) { 128 unsafe { 129 let mut y0_ = mem::MaybeUninit::uninit(); 130 let mut y1_ = mem::MaybeUninit::uninit(); 131 ffi::pango_layout_iter_get_line_yrange( 132 self.to_glib_none_mut().0, 133 y0_.as_mut_ptr(), 134 y1_.as_mut_ptr(), 135 ); 136 let y0_ = y0_.assume_init(); 137 let y1_ = y1_.assume_init(); 138 (y0_, y1_) 139 } 140 } 141 142 #[doc(alias = "pango_layout_iter_get_run")] 143 #[doc(alias = "get_run")] run(&mut self) -> Option<LayoutRun>144 pub fn run(&mut self) -> Option<LayoutRun> { 145 unsafe { from_glib_none(ffi::pango_layout_iter_get_run(self.to_glib_none_mut().0)) } 146 } 147 148 #[doc(alias = "pango_layout_iter_get_run_extents")] 149 #[doc(alias = "get_run_extents")] run_extents(&mut self) -> (Rectangle, Rectangle)150 pub fn run_extents(&mut self) -> (Rectangle, Rectangle) { 151 unsafe { 152 let mut ink_rect = Rectangle::uninitialized(); 153 let mut logical_rect = Rectangle::uninitialized(); 154 ffi::pango_layout_iter_get_run_extents( 155 self.to_glib_none_mut().0, 156 ink_rect.to_glib_none_mut().0, 157 logical_rect.to_glib_none_mut().0, 158 ); 159 (ink_rect, logical_rect) 160 } 161 } 162 163 #[doc(alias = "pango_layout_iter_get_run_readonly")] 164 #[doc(alias = "get_run_readonly")] run_readonly(&mut self) -> Option<LayoutRun>165 pub fn run_readonly(&mut self) -> Option<LayoutRun> { 166 unsafe { 167 from_glib_none(ffi::pango_layout_iter_get_run_readonly( 168 self.to_glib_none_mut().0, 169 )) 170 } 171 } 172 173 #[doc(alias = "pango_layout_iter_next_char")] next_char(&mut self) -> bool174 pub fn next_char(&mut self) -> bool { 175 unsafe { from_glib(ffi::pango_layout_iter_next_char(self.to_glib_none_mut().0)) } 176 } 177 178 #[doc(alias = "pango_layout_iter_next_cluster")] next_cluster(&mut self) -> bool179 pub fn next_cluster(&mut self) -> bool { 180 unsafe { 181 from_glib(ffi::pango_layout_iter_next_cluster( 182 self.to_glib_none_mut().0, 183 )) 184 } 185 } 186 187 #[doc(alias = "pango_layout_iter_next_line")] next_line(&mut self) -> bool188 pub fn next_line(&mut self) -> bool { 189 unsafe { from_glib(ffi::pango_layout_iter_next_line(self.to_glib_none_mut().0)) } 190 } 191 192 #[doc(alias = "pango_layout_iter_next_run")] next_run(&mut self) -> bool193 pub fn next_run(&mut self) -> bool { 194 unsafe { from_glib(ffi::pango_layout_iter_next_run(self.to_glib_none_mut().0)) } 195 } 196 } 197