@@ -57,6 +57,18 @@ pub trait AccessibleTextImpl: WidgetImpl {
57
57
fn selection ( & self ) -> Vec < AccessibleTextRange > {
58
58
self . parent_selection ( )
59
59
}
60
+
61
+ #[ cfg( feature = "v4_22" ) ]
62
+ #[ cfg_attr( docsrs, doc( cfg( feature = "v4_22" ) ) ) ]
63
+ fn set_caret_position ( & self , position : u32 ) -> bool {
64
+ self . parent_set_caret_position ( position)
65
+ }
66
+
67
+ #[ cfg( feature = "v4_22" ) ]
68
+ #[ cfg_attr( docsrs, doc( cfg( feature = "v4_22" ) ) ) ]
69
+ fn set_selection ( & self , selection : usize , range : AccessibleTextRange ) -> bool {
70
+ self . parent_set_selection ( selection, range)
71
+ }
60
72
}
61
73
62
74
pub trait AccessibleTextImplExt : AccessibleTextImpl {
@@ -314,6 +326,51 @@ pub trait AccessibleTextImplExt: AccessibleTextImpl {
314
326
}
315
327
}
316
328
}
329
+
330
+ #[ cfg( feature = "v4_22" ) ]
331
+ #[ cfg_attr( docsrs, doc( cfg( feature = "v4_22" ) ) ) ]
332
+ fn parent_set_caret_position ( & self , position : u32 ) -> bool {
333
+ unsafe {
334
+ let type_data = Self :: type_data ( ) ;
335
+ let parent_iface = type_data. as_ref ( ) . parent_interface :: < AccessibleText > ( )
336
+ as * const ffi:: GtkAccessibleTextInterface ;
337
+
338
+ let func = ( * parent_iface)
339
+ . set_caret_position
340
+ . expect ( "no parent \" set_caret_position\" implementation" ) ;
341
+
342
+ from_glib ( func (
343
+ self . obj ( )
344
+ . unsafe_cast_ref :: < AccessibleText > ( )
345
+ . to_glib_none ( )
346
+ . 0 ,
347
+ position,
348
+ ) )
349
+ }
350
+ }
351
+
352
+ #[ cfg( feature = "v4_22" ) ]
353
+ #[ cfg_attr( docsrs, doc( cfg( feature = "v4_22" ) ) ) ]
354
+ fn parent_set_selection ( & self , selection : usize , range : AccessibleTextRange ) -> bool {
355
+ unsafe {
356
+ let type_data = Self :: type_data ( ) ;
357
+ let parent_iface = type_data. as_ref ( ) . parent_interface :: < AccessibleText > ( )
358
+ as * const ffi:: GtkAccessibleTextInterface ;
359
+
360
+ let func = ( * parent_iface)
361
+ . set_selection
362
+ . expect ( "no parent \" set_selection\" implementation" ) ;
363
+
364
+ from_glib ( func (
365
+ self . obj ( )
366
+ . unsafe_cast_ref :: < AccessibleText > ( )
367
+ . to_glib_none ( )
368
+ . 0 ,
369
+ selection,
370
+ mut_override ( range. to_glib_none ( ) . 0 ) ,
371
+ ) )
372
+ }
373
+ }
317
374
}
318
375
319
376
impl < T : AccessibleTextImpl > AccessibleTextImplExt for T { }
@@ -334,6 +391,12 @@ unsafe impl<T: AccessibleTextImpl> IsImplementable<T> for AccessibleText {
334
391
iface. get_extents = Some ( accessible_text_get_extents :: < T > ) ;
335
392
iface. get_offset = Some ( accessible_text_get_offset :: < T > ) ;
336
393
}
394
+
395
+ #[ cfg( feature = "v4_22" ) ]
396
+ {
397
+ iface. set_caret_position = Some ( accessible_text_set_caret_position :: < T > ) ;
398
+ iface. set_selection = Some ( accessible_text_set_selection :: < T > ) ;
399
+ }
337
400
}
338
401
}
339
402
@@ -497,7 +560,6 @@ unsafe extern "C" fn accessible_text_get_extents<T: AccessibleTextImpl>(
497
560
}
498
561
499
562
#[ cfg( feature = "v4_16" ) ]
500
- #[ cfg_attr( docsrs, doc( cfg( feature = "v4_16" ) ) ) ]
501
563
unsafe extern "C" fn accessible_text_get_offset < T : AccessibleTextImpl > (
502
564
accessible_text : * mut ffi:: GtkAccessibleText ,
503
565
point : * const graphene:: ffi:: graphene_point_t ,
@@ -519,6 +581,30 @@ unsafe extern "C" fn accessible_text_get_offset<T: AccessibleTextImpl>(
519
581
. into_glib ( )
520
582
}
521
583
584
+ #[ cfg( feature = "v4_22" ) ]
585
+ unsafe extern "C" fn accessible_text_set_caret_position < T : AccessibleTextImpl > (
586
+ accessible_text : * mut ffi:: GtkAccessibleText ,
587
+ position : u32 ,
588
+ ) -> glib:: ffi:: gboolean {
589
+ let instance = & * ( accessible_text as * mut T :: Instance ) ;
590
+ let imp = instance. imp ( ) ;
591
+
592
+ imp. set_caret_position ( position) . into_glib ( )
593
+ }
594
+
595
+ #[ cfg( feature = "v4_22" ) ]
596
+ unsafe extern "C" fn accessible_text_set_selection < T : AccessibleTextImpl > (
597
+ accessible_text : * mut ffi:: GtkAccessibleText ,
598
+ selection : usize ,
599
+ range : * mut ffi:: GtkAccessibleTextRange ,
600
+ ) -> glib:: ffi:: gboolean {
601
+ let instance = & * ( accessible_text as * mut T :: Instance ) ;
602
+ let imp = instance. imp ( ) ;
603
+
604
+ imp. set_selection ( selection, from_glib_none ( range) )
605
+ . into_glib ( )
606
+ }
607
+
522
608
#[ cfg( test) ]
523
609
mod test {
524
610
use crate as gtk4;
0 commit comments