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
// 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 atk_sys; use glib::object::Cast; use glib::object::IsA; use glib::translate::*; use std::fmt; use Component; use Object; glib_wrapper! { /// Together with `Plug`, `Socket` provides the ability to embed /// accessibles from one process into another in a fashion that is /// transparent to assistive technologies. `Socket` works as the /// container of `Plug`, embedding it using the method /// `AtkSocketExt::embed`. Any accessible contained in the `Plug` will /// appear to the assistive technologies as being inside the /// application that created the `Socket`. /// /// The communication between a `Socket` and a `Plug` is done by /// the IPC layer of the accessibility framework, normally implemented /// by the D-Bus based implementation of AT-SPI (at-spi2). If that is /// the case, at-spi-atk2 is the responsible to implement the abstract /// methods `AtkPlugExt::get_id` and `AtkSocketExt::embed`, so an ATK /// implementor shouldn't reimplement them. The process that contains /// the `Plug` is responsible to send the ID returned by /// `atk_plug_id` to the process that contains the `Socket`, so it /// could call the method `AtkSocketExt::embed` in order to embed it. /// /// For the same reasons, an implementor doesn't need to implement /// `AtkObjectExt::get_n_accessible_children` and /// `AtkObjectExt::ref_accessible_child`. All the logic related to those /// functions will be implemented by the IPC layer. /// /// # Implements /// /// [`AtkSocketExt`](trait.AtkSocketExt.html), [`AtkObjectExt`](trait.AtkObjectExt.html), [`glib::object::ObjectExt`](../glib/object/trait.ObjectExt.html), [`ComponentExt`](trait.ComponentExt.html) pub struct Socket(Object<atk_sys::AtkSocket, atk_sys::AtkSocketClass, SocketClass>) @extends Object, @implements Component; match fn { get_type => || atk_sys::atk_socket_get_type(), } } impl Socket { /// Creates a new `Socket`. /// /// # Returns /// /// the newly created `Socket` instance pub fn new() -> Socket { assert_initialized_main_thread!(); unsafe { Object::from_glib_full(atk_sys::atk_socket_new()).unsafe_cast() } } } impl Default for Socket { fn default() -> Self { Self::new() } } pub const NONE_SOCKET: Option<&Socket> = None; /// Trait containing all `Socket` methods. /// /// # Implementors /// /// [`Socket`](struct.Socket.html) pub trait AtkSocketExt: 'static { /// Embeds the children of an `Plug` as the children of the /// `Socket`. The plug may be in the same process or in a different /// process. /// /// The class item used by this function should be filled in by the IPC /// layer (usually at-spi2-atk). The implementor of the AtkSocket /// should call this function and pass the id for the plug as returned /// by `AtkPlugExt::get_id`. It is the responsibility of the application /// to pass the plug id on to the process implementing the `Socket` /// as needed. /// ## `plug_id` /// the ID of an `Plug` fn embed(&self, plug_id: &str); /// Determines whether or not the socket has an embedded plug. /// /// # Returns /// /// TRUE if a plug is embedded in the socket fn is_occupied(&self) -> bool; } impl<O: IsA<Socket>> AtkSocketExt for O { fn embed(&self, plug_id: &str) { unsafe { atk_sys::atk_socket_embed(self.as_ref().to_glib_none().0, plug_id.to_glib_none().0); } } fn is_occupied(&self) -> bool { unsafe { from_glib(atk_sys::atk_socket_is_occupied( self.as_ref().to_glib_none().0, )) } } } impl fmt::Display for Socket { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "Socket") } }