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::TextBuffer;
6 use crate::TextChildAnchor;
7 use crate::TextMark;
8 use crate::TextSearchFlags;
9 use crate::TextTag;
10 use glib::object::IsA;
11 use glib::translate::*;
12 use std::cmp;
13 
14 glib::wrapper! {
15     #[derive(Debug, Hash)]
16     pub struct TextIter(Boxed<ffi::GtkTextIter>);
17 
18     match fn {
19         copy => |ptr| ffi::gtk_text_iter_copy(ptr),
20         free => |ptr| ffi::gtk_text_iter_free(ptr),
21         init => |_ptr| (),
22         clear => |_ptr| (),
23         type_ => || ffi::gtk_text_iter_get_type(),
24     }
25 }
26 
27 impl TextIter {
28     #[doc(alias = "gtk_text_iter_assign")]
assign(&mut self, other: &TextIter)29     pub fn assign(&mut self, other: &TextIter) {
30         unsafe {
31             ffi::gtk_text_iter_assign(self.to_glib_none_mut().0, other.to_glib_none().0);
32         }
33     }
34 
35     #[doc(alias = "gtk_text_iter_backward_char")]
backward_char(&mut self) -> bool36     pub fn backward_char(&mut self) -> bool {
37         unsafe { from_glib(ffi::gtk_text_iter_backward_char(self.to_glib_none_mut().0)) }
38     }
39 
40     #[doc(alias = "gtk_text_iter_backward_chars")]
backward_chars(&mut self, count: i32) -> bool41     pub fn backward_chars(&mut self, count: i32) -> bool {
42         unsafe {
43             from_glib(ffi::gtk_text_iter_backward_chars(
44                 self.to_glib_none_mut().0,
45                 count,
46             ))
47         }
48     }
49 
50     #[doc(alias = "gtk_text_iter_backward_cursor_position")]
backward_cursor_position(&mut self) -> bool51     pub fn backward_cursor_position(&mut self) -> bool {
52         unsafe {
53             from_glib(ffi::gtk_text_iter_backward_cursor_position(
54                 self.to_glib_none_mut().0,
55             ))
56         }
57     }
58 
59     #[doc(alias = "gtk_text_iter_backward_cursor_positions")]
backward_cursor_positions(&mut self, count: i32) -> bool60     pub fn backward_cursor_positions(&mut self, count: i32) -> bool {
61         unsafe {
62             from_glib(ffi::gtk_text_iter_backward_cursor_positions(
63                 self.to_glib_none_mut().0,
64                 count,
65             ))
66         }
67     }
68 
69     #[doc(alias = "gtk_text_iter_backward_find_char")]
backward_find_char<P: FnMut(char) -> bool>( &mut self, pred: P, limit: Option<&TextIter>, ) -> bool70     pub fn backward_find_char<P: FnMut(char) -> bool>(
71         &mut self,
72         pred: P,
73         limit: Option<&TextIter>,
74     ) -> bool {
75         let pred_data: P = pred;
76         unsafe extern "C" fn pred_func<P: FnMut(char) -> bool>(
77             ch: u32,
78             user_data: glib::ffi::gpointer,
79         ) -> glib::ffi::gboolean {
80             let ch = std::convert::TryFrom::try_from(ch)
81                 .expect("conversion from an invalid Unicode value attempted");
82             let callback: *mut P = user_data as *const _ as usize as *mut P;
83             let res = (*callback)(ch);
84             res.into_glib()
85         }
86         let pred = Some(pred_func::<P> as _);
87         let super_callback0: &P = &pred_data;
88         unsafe {
89             from_glib(ffi::gtk_text_iter_backward_find_char(
90                 self.to_glib_none_mut().0,
91                 pred,
92                 super_callback0 as *const _ as usize as *mut _,
93                 limit.to_glib_none().0,
94             ))
95         }
96     }
97 
98     #[doc(alias = "gtk_text_iter_backward_line")]
backward_line(&mut self) -> bool99     pub fn backward_line(&mut self) -> bool {
100         unsafe { from_glib(ffi::gtk_text_iter_backward_line(self.to_glib_none_mut().0)) }
101     }
102 
103     #[doc(alias = "gtk_text_iter_backward_lines")]
backward_lines(&mut self, count: i32) -> bool104     pub fn backward_lines(&mut self, count: i32) -> bool {
105         unsafe {
106             from_glib(ffi::gtk_text_iter_backward_lines(
107                 self.to_glib_none_mut().0,
108                 count,
109             ))
110         }
111     }
112 
113     #[doc(alias = "gtk_text_iter_backward_search")]
backward_search( &self, str: &str, flags: TextSearchFlags, limit: Option<&TextIter>, ) -> Option<(TextIter, TextIter)>114     pub fn backward_search(
115         &self,
116         str: &str,
117         flags: TextSearchFlags,
118         limit: Option<&TextIter>,
119     ) -> Option<(TextIter, TextIter)> {
120         unsafe {
121             let mut match_start = TextIter::uninitialized();
122             let mut match_end = TextIter::uninitialized();
123             let ret = from_glib(ffi::gtk_text_iter_backward_search(
124                 self.to_glib_none().0,
125                 str.to_glib_none().0,
126                 flags.into_glib(),
127                 match_start.to_glib_none_mut().0,
128                 match_end.to_glib_none_mut().0,
129                 limit.to_glib_none().0,
130             ));
131             if ret {
132                 Some((match_start, match_end))
133             } else {
134                 None
135             }
136         }
137     }
138 
139     #[doc(alias = "gtk_text_iter_backward_sentence_start")]
backward_sentence_start(&mut self) -> bool140     pub fn backward_sentence_start(&mut self) -> bool {
141         unsafe {
142             from_glib(ffi::gtk_text_iter_backward_sentence_start(
143                 self.to_glib_none_mut().0,
144             ))
145         }
146     }
147 
148     #[doc(alias = "gtk_text_iter_backward_sentence_starts")]
backward_sentence_starts(&mut self, count: i32) -> bool149     pub fn backward_sentence_starts(&mut self, count: i32) -> bool {
150         unsafe {
151             from_glib(ffi::gtk_text_iter_backward_sentence_starts(
152                 self.to_glib_none_mut().0,
153                 count,
154             ))
155         }
156     }
157 
158     #[doc(alias = "gtk_text_iter_backward_to_tag_toggle")]
backward_to_tag_toggle<P: IsA<TextTag>>(&mut self, tag: Option<&P>) -> bool159     pub fn backward_to_tag_toggle<P: IsA<TextTag>>(&mut self, tag: Option<&P>) -> bool {
160         unsafe {
161             from_glib(ffi::gtk_text_iter_backward_to_tag_toggle(
162                 self.to_glib_none_mut().0,
163                 tag.map(|p| p.as_ref()).to_glib_none().0,
164             ))
165         }
166     }
167 
168     #[doc(alias = "gtk_text_iter_backward_visible_cursor_position")]
backward_visible_cursor_position(&mut self) -> bool169     pub fn backward_visible_cursor_position(&mut self) -> bool {
170         unsafe {
171             from_glib(ffi::gtk_text_iter_backward_visible_cursor_position(
172                 self.to_glib_none_mut().0,
173             ))
174         }
175     }
176 
177     #[doc(alias = "gtk_text_iter_backward_visible_cursor_positions")]
backward_visible_cursor_positions(&mut self, count: i32) -> bool178     pub fn backward_visible_cursor_positions(&mut self, count: i32) -> bool {
179         unsafe {
180             from_glib(ffi::gtk_text_iter_backward_visible_cursor_positions(
181                 self.to_glib_none_mut().0,
182                 count,
183             ))
184         }
185     }
186 
187     #[doc(alias = "gtk_text_iter_backward_visible_line")]
backward_visible_line(&mut self) -> bool188     pub fn backward_visible_line(&mut self) -> bool {
189         unsafe {
190             from_glib(ffi::gtk_text_iter_backward_visible_line(
191                 self.to_glib_none_mut().0,
192             ))
193         }
194     }
195 
196     #[doc(alias = "gtk_text_iter_backward_visible_lines")]
backward_visible_lines(&mut self, count: i32) -> bool197     pub fn backward_visible_lines(&mut self, count: i32) -> bool {
198         unsafe {
199             from_glib(ffi::gtk_text_iter_backward_visible_lines(
200                 self.to_glib_none_mut().0,
201                 count,
202             ))
203         }
204     }
205 
206     #[doc(alias = "gtk_text_iter_backward_visible_word_start")]
backward_visible_word_start(&mut self) -> bool207     pub fn backward_visible_word_start(&mut self) -> bool {
208         unsafe {
209             from_glib(ffi::gtk_text_iter_backward_visible_word_start(
210                 self.to_glib_none_mut().0,
211             ))
212         }
213     }
214 
215     #[doc(alias = "gtk_text_iter_backward_visible_word_starts")]
backward_visible_word_starts(&mut self, count: i32) -> bool216     pub fn backward_visible_word_starts(&mut self, count: i32) -> bool {
217         unsafe {
218             from_glib(ffi::gtk_text_iter_backward_visible_word_starts(
219                 self.to_glib_none_mut().0,
220                 count,
221             ))
222         }
223     }
224 
225     #[doc(alias = "gtk_text_iter_backward_word_start")]
backward_word_start(&mut self) -> bool226     pub fn backward_word_start(&mut self) -> bool {
227         unsafe {
228             from_glib(ffi::gtk_text_iter_backward_word_start(
229                 self.to_glib_none_mut().0,
230             ))
231         }
232     }
233 
234     #[doc(alias = "gtk_text_iter_backward_word_starts")]
backward_word_starts(&mut self, count: i32) -> bool235     pub fn backward_word_starts(&mut self, count: i32) -> bool {
236         unsafe {
237             from_glib(ffi::gtk_text_iter_backward_word_starts(
238                 self.to_glib_none_mut().0,
239                 count,
240             ))
241         }
242     }
243 
244     #[cfg_attr(feature = "v3_20", deprecated = "Since 3.20")]
245     #[doc(alias = "gtk_text_iter_begins_tag")]
begins_tag<P: IsA<TextTag>>(&self, tag: Option<&P>) -> bool246     pub fn begins_tag<P: IsA<TextTag>>(&self, tag: Option<&P>) -> bool {
247         unsafe {
248             from_glib(ffi::gtk_text_iter_begins_tag(
249                 self.to_glib_none().0,
250                 tag.map(|p| p.as_ref()).to_glib_none().0,
251             ))
252         }
253     }
254 
255     #[doc(alias = "gtk_text_iter_can_insert")]
can_insert(&self, default_editability: bool) -> bool256     pub fn can_insert(&self, default_editability: bool) -> bool {
257         unsafe {
258             from_glib(ffi::gtk_text_iter_can_insert(
259                 self.to_glib_none().0,
260                 default_editability.into_glib(),
261             ))
262         }
263     }
264 
265     #[doc(alias = "gtk_text_iter_compare")]
compare(&self, rhs: &TextIter) -> i32266     fn compare(&self, rhs: &TextIter) -> i32 {
267         unsafe { ffi::gtk_text_iter_compare(self.to_glib_none().0, rhs.to_glib_none().0) }
268     }
269 
270     #[doc(alias = "gtk_text_iter_editable")]
editable(&self, default_setting: bool) -> bool271     pub fn editable(&self, default_setting: bool) -> bool {
272         unsafe {
273             from_glib(ffi::gtk_text_iter_editable(
274                 self.to_glib_none().0,
275                 default_setting.into_glib(),
276             ))
277         }
278     }
279 
280     #[doc(alias = "gtk_text_iter_ends_line")]
ends_line(&self) -> bool281     pub fn ends_line(&self) -> bool {
282         unsafe { from_glib(ffi::gtk_text_iter_ends_line(self.to_glib_none().0)) }
283     }
284 
285     #[doc(alias = "gtk_text_iter_ends_sentence")]
ends_sentence(&self) -> bool286     pub fn ends_sentence(&self) -> bool {
287         unsafe { from_glib(ffi::gtk_text_iter_ends_sentence(self.to_glib_none().0)) }
288     }
289 
290     #[doc(alias = "gtk_text_iter_ends_tag")]
ends_tag<P: IsA<TextTag>>(&self, tag: Option<&P>) -> bool291     pub fn ends_tag<P: IsA<TextTag>>(&self, tag: Option<&P>) -> bool {
292         unsafe {
293             from_glib(ffi::gtk_text_iter_ends_tag(
294                 self.to_glib_none().0,
295                 tag.map(|p| p.as_ref()).to_glib_none().0,
296             ))
297         }
298     }
299 
300     #[doc(alias = "gtk_text_iter_ends_word")]
ends_word(&self) -> bool301     pub fn ends_word(&self) -> bool {
302         unsafe { from_glib(ffi::gtk_text_iter_ends_word(self.to_glib_none().0)) }
303     }
304 
305     #[doc(alias = "gtk_text_iter_equal")]
equal(&self, rhs: &TextIter) -> bool306     fn equal(&self, rhs: &TextIter) -> bool {
307         unsafe {
308             from_glib(ffi::gtk_text_iter_equal(
309                 self.to_glib_none().0,
310                 rhs.to_glib_none().0,
311             ))
312         }
313     }
314 
315     #[doc(alias = "gtk_text_iter_forward_char")]
forward_char(&mut self) -> bool316     pub fn forward_char(&mut self) -> bool {
317         unsafe { from_glib(ffi::gtk_text_iter_forward_char(self.to_glib_none_mut().0)) }
318     }
319 
320     #[doc(alias = "gtk_text_iter_forward_chars")]
forward_chars(&mut self, count: i32) -> bool321     pub fn forward_chars(&mut self, count: i32) -> bool {
322         unsafe {
323             from_glib(ffi::gtk_text_iter_forward_chars(
324                 self.to_glib_none_mut().0,
325                 count,
326             ))
327         }
328     }
329 
330     #[doc(alias = "gtk_text_iter_forward_cursor_position")]
forward_cursor_position(&mut self) -> bool331     pub fn forward_cursor_position(&mut self) -> bool {
332         unsafe {
333             from_glib(ffi::gtk_text_iter_forward_cursor_position(
334                 self.to_glib_none_mut().0,
335             ))
336         }
337     }
338 
339     #[doc(alias = "gtk_text_iter_forward_cursor_positions")]
forward_cursor_positions(&mut self, count: i32) -> bool340     pub fn forward_cursor_positions(&mut self, count: i32) -> bool {
341         unsafe {
342             from_glib(ffi::gtk_text_iter_forward_cursor_positions(
343                 self.to_glib_none_mut().0,
344                 count,
345             ))
346         }
347     }
348 
349     #[doc(alias = "gtk_text_iter_forward_find_char")]
forward_find_char<P: FnMut(char) -> bool>( &mut self, pred: P, limit: Option<&TextIter>, ) -> bool350     pub fn forward_find_char<P: FnMut(char) -> bool>(
351         &mut self,
352         pred: P,
353         limit: Option<&TextIter>,
354     ) -> bool {
355         let pred_data: P = pred;
356         unsafe extern "C" fn pred_func<P: FnMut(char) -> bool>(
357             ch: u32,
358             user_data: glib::ffi::gpointer,
359         ) -> glib::ffi::gboolean {
360             let ch = std::convert::TryFrom::try_from(ch)
361                 .expect("conversion from an invalid Unicode value attempted");
362             let callback: *mut P = user_data as *const _ as usize as *mut P;
363             let res = (*callback)(ch);
364             res.into_glib()
365         }
366         let pred = Some(pred_func::<P> as _);
367         let super_callback0: &P = &pred_data;
368         unsafe {
369             from_glib(ffi::gtk_text_iter_forward_find_char(
370                 self.to_glib_none_mut().0,
371                 pred,
372                 super_callback0 as *const _ as usize as *mut _,
373                 limit.to_glib_none().0,
374             ))
375         }
376     }
377 
378     #[doc(alias = "gtk_text_iter_forward_line")]
forward_line(&mut self) -> bool379     pub fn forward_line(&mut self) -> bool {
380         unsafe { from_glib(ffi::gtk_text_iter_forward_line(self.to_glib_none_mut().0)) }
381     }
382 
383     #[doc(alias = "gtk_text_iter_forward_lines")]
forward_lines(&mut self, count: i32) -> bool384     pub fn forward_lines(&mut self, count: i32) -> bool {
385         unsafe {
386             from_glib(ffi::gtk_text_iter_forward_lines(
387                 self.to_glib_none_mut().0,
388                 count,
389             ))
390         }
391     }
392 
393     #[doc(alias = "gtk_text_iter_forward_search")]
forward_search( &self, str: &str, flags: TextSearchFlags, limit: Option<&TextIter>, ) -> Option<(TextIter, TextIter)>394     pub fn forward_search(
395         &self,
396         str: &str,
397         flags: TextSearchFlags,
398         limit: Option<&TextIter>,
399     ) -> Option<(TextIter, TextIter)> {
400         unsafe {
401             let mut match_start = TextIter::uninitialized();
402             let mut match_end = TextIter::uninitialized();
403             let ret = from_glib(ffi::gtk_text_iter_forward_search(
404                 self.to_glib_none().0,
405                 str.to_glib_none().0,
406                 flags.into_glib(),
407                 match_start.to_glib_none_mut().0,
408                 match_end.to_glib_none_mut().0,
409                 limit.to_glib_none().0,
410             ));
411             if ret {
412                 Some((match_start, match_end))
413             } else {
414                 None
415             }
416         }
417     }
418 
419     #[doc(alias = "gtk_text_iter_forward_sentence_end")]
forward_sentence_end(&mut self) -> bool420     pub fn forward_sentence_end(&mut self) -> bool {
421         unsafe {
422             from_glib(ffi::gtk_text_iter_forward_sentence_end(
423                 self.to_glib_none_mut().0,
424             ))
425         }
426     }
427 
428     #[doc(alias = "gtk_text_iter_forward_sentence_ends")]
forward_sentence_ends(&mut self, count: i32) -> bool429     pub fn forward_sentence_ends(&mut self, count: i32) -> bool {
430         unsafe {
431             from_glib(ffi::gtk_text_iter_forward_sentence_ends(
432                 self.to_glib_none_mut().0,
433                 count,
434             ))
435         }
436     }
437 
438     #[doc(alias = "gtk_text_iter_forward_to_end")]
forward_to_end(&mut self)439     pub fn forward_to_end(&mut self) {
440         unsafe {
441             ffi::gtk_text_iter_forward_to_end(self.to_glib_none_mut().0);
442         }
443     }
444 
445     #[doc(alias = "gtk_text_iter_forward_to_line_end")]
forward_to_line_end(&mut self) -> bool446     pub fn forward_to_line_end(&mut self) -> bool {
447         unsafe {
448             from_glib(ffi::gtk_text_iter_forward_to_line_end(
449                 self.to_glib_none_mut().0,
450             ))
451         }
452     }
453 
454     #[doc(alias = "gtk_text_iter_forward_to_tag_toggle")]
forward_to_tag_toggle<P: IsA<TextTag>>(&mut self, tag: Option<&P>) -> bool455     pub fn forward_to_tag_toggle<P: IsA<TextTag>>(&mut self, tag: Option<&P>) -> bool {
456         unsafe {
457             from_glib(ffi::gtk_text_iter_forward_to_tag_toggle(
458                 self.to_glib_none_mut().0,
459                 tag.map(|p| p.as_ref()).to_glib_none().0,
460             ))
461         }
462     }
463 
464     #[doc(alias = "gtk_text_iter_forward_visible_cursor_position")]
forward_visible_cursor_position(&mut self) -> bool465     pub fn forward_visible_cursor_position(&mut self) -> bool {
466         unsafe {
467             from_glib(ffi::gtk_text_iter_forward_visible_cursor_position(
468                 self.to_glib_none_mut().0,
469             ))
470         }
471     }
472 
473     #[doc(alias = "gtk_text_iter_forward_visible_cursor_positions")]
forward_visible_cursor_positions(&mut self, count: i32) -> bool474     pub fn forward_visible_cursor_positions(&mut self, count: i32) -> bool {
475         unsafe {
476             from_glib(ffi::gtk_text_iter_forward_visible_cursor_positions(
477                 self.to_glib_none_mut().0,
478                 count,
479             ))
480         }
481     }
482 
483     #[doc(alias = "gtk_text_iter_forward_visible_line")]
forward_visible_line(&mut self) -> bool484     pub fn forward_visible_line(&mut self) -> bool {
485         unsafe {
486             from_glib(ffi::gtk_text_iter_forward_visible_line(
487                 self.to_glib_none_mut().0,
488             ))
489         }
490     }
491 
492     #[doc(alias = "gtk_text_iter_forward_visible_lines")]
forward_visible_lines(&mut self, count: i32) -> bool493     pub fn forward_visible_lines(&mut self, count: i32) -> bool {
494         unsafe {
495             from_glib(ffi::gtk_text_iter_forward_visible_lines(
496                 self.to_glib_none_mut().0,
497                 count,
498             ))
499         }
500     }
501 
502     #[doc(alias = "gtk_text_iter_forward_visible_word_end")]
forward_visible_word_end(&mut self) -> bool503     pub fn forward_visible_word_end(&mut self) -> bool {
504         unsafe {
505             from_glib(ffi::gtk_text_iter_forward_visible_word_end(
506                 self.to_glib_none_mut().0,
507             ))
508         }
509     }
510 
511     #[doc(alias = "gtk_text_iter_forward_visible_word_ends")]
forward_visible_word_ends(&mut self, count: i32) -> bool512     pub fn forward_visible_word_ends(&mut self, count: i32) -> bool {
513         unsafe {
514             from_glib(ffi::gtk_text_iter_forward_visible_word_ends(
515                 self.to_glib_none_mut().0,
516                 count,
517             ))
518         }
519     }
520 
521     #[doc(alias = "gtk_text_iter_forward_word_end")]
forward_word_end(&mut self) -> bool522     pub fn forward_word_end(&mut self) -> bool {
523         unsafe {
524             from_glib(ffi::gtk_text_iter_forward_word_end(
525                 self.to_glib_none_mut().0,
526             ))
527         }
528     }
529 
530     #[doc(alias = "gtk_text_iter_forward_word_ends")]
forward_word_ends(&mut self, count: i32) -> bool531     pub fn forward_word_ends(&mut self, count: i32) -> bool {
532         unsafe {
533             from_glib(ffi::gtk_text_iter_forward_word_ends(
534                 self.to_glib_none_mut().0,
535                 count,
536             ))
537         }
538     }
539 
540     #[doc(alias = "gtk_text_iter_get_buffer")]
541     #[doc(alias = "get_buffer")]
buffer(&self) -> Option<TextBuffer>542     pub fn buffer(&self) -> Option<TextBuffer> {
543         unsafe { from_glib_none(ffi::gtk_text_iter_get_buffer(self.to_glib_none().0)) }
544     }
545 
546     #[doc(alias = "gtk_text_iter_get_bytes_in_line")]
547     #[doc(alias = "get_bytes_in_line")]
bytes_in_line(&self) -> i32548     pub fn bytes_in_line(&self) -> i32 {
549         unsafe { ffi::gtk_text_iter_get_bytes_in_line(self.to_glib_none().0) }
550     }
551 
552     #[doc(alias = "gtk_text_iter_get_chars_in_line")]
553     #[doc(alias = "get_chars_in_line")]
chars_in_line(&self) -> i32554     pub fn chars_in_line(&self) -> i32 {
555         unsafe { ffi::gtk_text_iter_get_chars_in_line(self.to_glib_none().0) }
556     }
557 
558     #[doc(alias = "gtk_text_iter_get_child_anchor")]
559     #[doc(alias = "get_child_anchor")]
child_anchor(&self) -> Option<TextChildAnchor>560     pub fn child_anchor(&self) -> Option<TextChildAnchor> {
561         unsafe { from_glib_none(ffi::gtk_text_iter_get_child_anchor(self.to_glib_none().0)) }
562     }
563 
564     #[doc(alias = "gtk_text_iter_get_language")]
565     #[doc(alias = "get_language")]
language(&self) -> Option<pango::Language>566     pub fn language(&self) -> Option<pango::Language> {
567         unsafe { from_glib_full(ffi::gtk_text_iter_get_language(self.to_glib_none().0)) }
568     }
569 
570     #[doc(alias = "gtk_text_iter_get_line")]
571     #[doc(alias = "get_line")]
line(&self) -> i32572     pub fn line(&self) -> i32 {
573         unsafe { ffi::gtk_text_iter_get_line(self.to_glib_none().0) }
574     }
575 
576     #[doc(alias = "gtk_text_iter_get_line_index")]
577     #[doc(alias = "get_line_index")]
line_index(&self) -> i32578     pub fn line_index(&self) -> i32 {
579         unsafe { ffi::gtk_text_iter_get_line_index(self.to_glib_none().0) }
580     }
581 
582     #[doc(alias = "gtk_text_iter_get_line_offset")]
583     #[doc(alias = "get_line_offset")]
line_offset(&self) -> i32584     pub fn line_offset(&self) -> i32 {
585         unsafe { ffi::gtk_text_iter_get_line_offset(self.to_glib_none().0) }
586     }
587 
588     #[doc(alias = "gtk_text_iter_get_marks")]
589     #[doc(alias = "get_marks")]
marks(&self) -> Vec<TextMark>590     pub fn marks(&self) -> Vec<TextMark> {
591         unsafe {
592             FromGlibPtrContainer::from_glib_container(ffi::gtk_text_iter_get_marks(
593                 self.to_glib_none().0,
594             ))
595         }
596     }
597 
598     #[doc(alias = "gtk_text_iter_get_offset")]
599     #[doc(alias = "get_offset")]
offset(&self) -> i32600     pub fn offset(&self) -> i32 {
601         unsafe { ffi::gtk_text_iter_get_offset(self.to_glib_none().0) }
602     }
603 
604     #[doc(alias = "gtk_text_iter_get_pixbuf")]
605     #[doc(alias = "get_pixbuf")]
pixbuf(&self) -> Option<gdk_pixbuf::Pixbuf>606     pub fn pixbuf(&self) -> Option<gdk_pixbuf::Pixbuf> {
607         unsafe { from_glib_none(ffi::gtk_text_iter_get_pixbuf(self.to_glib_none().0)) }
608     }
609 
610     #[doc(alias = "gtk_text_iter_get_slice")]
611     #[doc(alias = "get_slice")]
slice(&self, end: &TextIter) -> Option<glib::GString>612     pub fn slice(&self, end: &TextIter) -> Option<glib::GString> {
613         unsafe {
614             from_glib_full(ffi::gtk_text_iter_get_slice(
615                 self.to_glib_none().0,
616                 end.to_glib_none().0,
617             ))
618         }
619     }
620 
621     #[doc(alias = "gtk_text_iter_get_tags")]
622     #[doc(alias = "get_tags")]
tags(&self) -> Vec<TextTag>623     pub fn tags(&self) -> Vec<TextTag> {
624         unsafe {
625             FromGlibPtrContainer::from_glib_container(ffi::gtk_text_iter_get_tags(
626                 self.to_glib_none().0,
627             ))
628         }
629     }
630 
631     #[doc(alias = "gtk_text_iter_get_text")]
632     #[doc(alias = "get_text")]
text(&self, end: &TextIter) -> Option<glib::GString>633     pub fn text(&self, end: &TextIter) -> Option<glib::GString> {
634         unsafe {
635             from_glib_full(ffi::gtk_text_iter_get_text(
636                 self.to_glib_none().0,
637                 end.to_glib_none().0,
638             ))
639         }
640     }
641 
642     #[doc(alias = "gtk_text_iter_get_toggled_tags")]
643     #[doc(alias = "get_toggled_tags")]
toggled_tags(&self, toggled_on: bool) -> Vec<TextTag>644     pub fn toggled_tags(&self, toggled_on: bool) -> Vec<TextTag> {
645         unsafe {
646             FromGlibPtrContainer::from_glib_container(ffi::gtk_text_iter_get_toggled_tags(
647                 self.to_glib_none().0,
648                 toggled_on.into_glib(),
649             ))
650         }
651     }
652 
653     #[doc(alias = "gtk_text_iter_get_visible_line_index")]
654     #[doc(alias = "get_visible_line_index")]
visible_line_index(&self) -> i32655     pub fn visible_line_index(&self) -> i32 {
656         unsafe { ffi::gtk_text_iter_get_visible_line_index(self.to_glib_none().0) }
657     }
658 
659     #[doc(alias = "gtk_text_iter_get_visible_line_offset")]
660     #[doc(alias = "get_visible_line_offset")]
visible_line_offset(&self) -> i32661     pub fn visible_line_offset(&self) -> i32 {
662         unsafe { ffi::gtk_text_iter_get_visible_line_offset(self.to_glib_none().0) }
663     }
664 
665     #[doc(alias = "gtk_text_iter_get_visible_slice")]
666     #[doc(alias = "get_visible_slice")]
visible_slice(&self, end: &TextIter) -> Option<glib::GString>667     pub fn visible_slice(&self, end: &TextIter) -> Option<glib::GString> {
668         unsafe {
669             from_glib_full(ffi::gtk_text_iter_get_visible_slice(
670                 self.to_glib_none().0,
671                 end.to_glib_none().0,
672             ))
673         }
674     }
675 
676     #[doc(alias = "gtk_text_iter_get_visible_text")]
677     #[doc(alias = "get_visible_text")]
visible_text(&self, end: &TextIter) -> Option<glib::GString>678     pub fn visible_text(&self, end: &TextIter) -> Option<glib::GString> {
679         unsafe {
680             from_glib_full(ffi::gtk_text_iter_get_visible_text(
681                 self.to_glib_none().0,
682                 end.to_glib_none().0,
683             ))
684         }
685     }
686 
687     #[doc(alias = "gtk_text_iter_has_tag")]
has_tag<P: IsA<TextTag>>(&self, tag: &P) -> bool688     pub fn has_tag<P: IsA<TextTag>>(&self, tag: &P) -> bool {
689         unsafe {
690             from_glib(ffi::gtk_text_iter_has_tag(
691                 self.to_glib_none().0,
692                 tag.as_ref().to_glib_none().0,
693             ))
694         }
695     }
696 
697     #[doc(alias = "gtk_text_iter_in_range")]
in_range(&self, start: &TextIter, end: &TextIter) -> bool698     pub fn in_range(&self, start: &TextIter, end: &TextIter) -> bool {
699         unsafe {
700             from_glib(ffi::gtk_text_iter_in_range(
701                 self.to_glib_none().0,
702                 start.to_glib_none().0,
703                 end.to_glib_none().0,
704             ))
705         }
706     }
707 
708     #[doc(alias = "gtk_text_iter_inside_sentence")]
inside_sentence(&self) -> bool709     pub fn inside_sentence(&self) -> bool {
710         unsafe { from_glib(ffi::gtk_text_iter_inside_sentence(self.to_glib_none().0)) }
711     }
712 
713     #[doc(alias = "gtk_text_iter_inside_word")]
inside_word(&self) -> bool714     pub fn inside_word(&self) -> bool {
715         unsafe { from_glib(ffi::gtk_text_iter_inside_word(self.to_glib_none().0)) }
716     }
717 
718     #[doc(alias = "gtk_text_iter_is_cursor_position")]
is_cursor_position(&self) -> bool719     pub fn is_cursor_position(&self) -> bool {
720         unsafe { from_glib(ffi::gtk_text_iter_is_cursor_position(self.to_glib_none().0)) }
721     }
722 
723     #[doc(alias = "gtk_text_iter_is_end")]
is_end(&self) -> bool724     pub fn is_end(&self) -> bool {
725         unsafe { from_glib(ffi::gtk_text_iter_is_end(self.to_glib_none().0)) }
726     }
727 
728     #[doc(alias = "gtk_text_iter_is_start")]
is_start(&self) -> bool729     pub fn is_start(&self) -> bool {
730         unsafe { from_glib(ffi::gtk_text_iter_is_start(self.to_glib_none().0)) }
731     }
732 
733     #[doc(alias = "gtk_text_iter_order")]
order(&mut self, second: &mut TextIter)734     pub fn order(&mut self, second: &mut TextIter) {
735         unsafe {
736             ffi::gtk_text_iter_order(self.to_glib_none_mut().0, second.to_glib_none_mut().0);
737         }
738     }
739 
740     #[doc(alias = "gtk_text_iter_set_line")]
set_line(&mut self, line_number: i32)741     pub fn set_line(&mut self, line_number: i32) {
742         unsafe {
743             ffi::gtk_text_iter_set_line(self.to_glib_none_mut().0, line_number);
744         }
745     }
746 
747     #[doc(alias = "gtk_text_iter_set_line_index")]
set_line_index(&mut self, byte_on_line: i32)748     pub fn set_line_index(&mut self, byte_on_line: i32) {
749         unsafe {
750             ffi::gtk_text_iter_set_line_index(self.to_glib_none_mut().0, byte_on_line);
751         }
752     }
753 
754     #[doc(alias = "gtk_text_iter_set_line_offset")]
set_line_offset(&mut self, char_on_line: i32)755     pub fn set_line_offset(&mut self, char_on_line: i32) {
756         unsafe {
757             ffi::gtk_text_iter_set_line_offset(self.to_glib_none_mut().0, char_on_line);
758         }
759     }
760 
761     #[doc(alias = "gtk_text_iter_set_offset")]
set_offset(&mut self, char_offset: i32)762     pub fn set_offset(&mut self, char_offset: i32) {
763         unsafe {
764             ffi::gtk_text_iter_set_offset(self.to_glib_none_mut().0, char_offset);
765         }
766     }
767 
768     #[doc(alias = "gtk_text_iter_set_visible_line_index")]
set_visible_line_index(&mut self, byte_on_line: i32)769     pub fn set_visible_line_index(&mut self, byte_on_line: i32) {
770         unsafe {
771             ffi::gtk_text_iter_set_visible_line_index(self.to_glib_none_mut().0, byte_on_line);
772         }
773     }
774 
775     #[doc(alias = "gtk_text_iter_set_visible_line_offset")]
set_visible_line_offset(&mut self, char_on_line: i32)776     pub fn set_visible_line_offset(&mut self, char_on_line: i32) {
777         unsafe {
778             ffi::gtk_text_iter_set_visible_line_offset(self.to_glib_none_mut().0, char_on_line);
779         }
780     }
781 
782     #[doc(alias = "gtk_text_iter_starts_line")]
starts_line(&self) -> bool783     pub fn starts_line(&self) -> bool {
784         unsafe { from_glib(ffi::gtk_text_iter_starts_line(self.to_glib_none().0)) }
785     }
786 
787     #[doc(alias = "gtk_text_iter_starts_sentence")]
starts_sentence(&self) -> bool788     pub fn starts_sentence(&self) -> bool {
789         unsafe { from_glib(ffi::gtk_text_iter_starts_sentence(self.to_glib_none().0)) }
790     }
791 
792     #[cfg(any(feature = "v3_20", feature = "dox"))]
793     #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_20")))]
794     #[doc(alias = "gtk_text_iter_starts_tag")]
starts_tag<P: IsA<TextTag>>(&self, tag: Option<&P>) -> bool795     pub fn starts_tag<P: IsA<TextTag>>(&self, tag: Option<&P>) -> bool {
796         unsafe {
797             from_glib(ffi::gtk_text_iter_starts_tag(
798                 self.to_glib_none().0,
799                 tag.map(|p| p.as_ref()).to_glib_none().0,
800             ))
801         }
802     }
803 
804     #[doc(alias = "gtk_text_iter_starts_word")]
starts_word(&self) -> bool805     pub fn starts_word(&self) -> bool {
806         unsafe { from_glib(ffi::gtk_text_iter_starts_word(self.to_glib_none().0)) }
807     }
808 
809     #[doc(alias = "gtk_text_iter_toggles_tag")]
toggles_tag<P: IsA<TextTag>>(&self, tag: Option<&P>) -> bool810     pub fn toggles_tag<P: IsA<TextTag>>(&self, tag: Option<&P>) -> bool {
811         unsafe {
812             from_glib(ffi::gtk_text_iter_toggles_tag(
813                 self.to_glib_none().0,
814                 tag.map(|p| p.as_ref()).to_glib_none().0,
815             ))
816         }
817     }
818 }
819 
820 impl PartialOrd for TextIter {
821     #[inline]
partial_cmp(&self, other: &Self) -> Option<cmp::Ordering>822     fn partial_cmp(&self, other: &Self) -> Option<cmp::Ordering> {
823         self.compare(other).partial_cmp(&0)
824     }
825 }
826 
827 impl Ord for TextIter {
828     #[inline]
cmp(&self, other: &Self) -> cmp::Ordering829     fn cmp(&self, other: &Self) -> cmp::Ordering {
830         self.compare(other).cmp(&0)
831     }
832 }
833 
834 impl PartialEq for TextIter {
835     #[inline]
eq(&self, other: &Self) -> bool836     fn eq(&self, other: &Self) -> bool {
837         self.equal(other)
838     }
839 }
840 
841 impl Eq for TextIter {}
842