atk/auto/plug.rs
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
5use crate::{Component, Object, ffi};
6use glib::{prelude::*, translate::*};
7
8glib::wrapper! {
9 /// Toplevel for embedding into other processes
10 ///
11 /// See [class[`Socket`][crate::Socket]]
12 ///
13 /// # Implements
14 ///
15 /// [`AtkPlugExt`][trait@crate::prelude::AtkPlugExt], [`AtkObjectExt`][trait@crate::prelude::AtkObjectExt], [`trait@glib::ObjectExt`], [`ComponentExt`][trait@crate::prelude::ComponentExt]
16 #[doc(alias = "AtkPlug")]
17 pub struct Plug(Object<ffi::AtkPlug, ffi::AtkPlugClass>) @extends Object, @implements Component;
18
19 match fn {
20 type_ => || ffi::atk_plug_get_type(),
21 }
22}
23
24impl Plug {
25 pub const NONE: Option<&'static Plug> = None;
26
27 /// Creates a new [`Plug`][crate::Plug] instance.
28 ///
29 /// # Returns
30 ///
31 /// the newly created [`Plug`][crate::Plug]
32 #[doc(alias = "atk_plug_new")]
33 pub fn new() -> Plug {
34 assert_initialized_main_thread!();
35 unsafe { Object::from_glib_full(ffi::atk_plug_new()).unsafe_cast() }
36 }
37}
38
39impl Default for Plug {
40 fn default() -> Self {
41 Self::new()
42 }
43}
44
45/// Trait containing all [`struct@Plug`] methods.
46///
47/// # Implementors
48///
49/// [`Plug`][struct@crate::Plug]
50pub trait AtkPlugExt: IsA<Plug> + 'static {
51 /// Gets the unique ID of an [`Plug`][crate::Plug] object, which can be used to
52 /// embed inside of an [`Socket`][crate::Socket] using [`AtkSocketExt::embed()`][crate::prelude::AtkSocketExt::embed()].
53 ///
54 /// Internally, this calls a class function that should be registered
55 /// by the IPC layer (usually at-spi2-atk). The implementor of an
56 /// [`Plug`][crate::Plug] object should call this function (after atk-bridge is
57 /// loaded) and pass the value to the process implementing the
58 /// [`Socket`][crate::Socket], so it could embed the plug.
59 ///
60 /// # Returns
61 ///
62 /// the unique ID for the plug
63 #[doc(alias = "atk_plug_get_id")]
64 #[doc(alias = "get_id")]
65 fn id(&self) -> Option<glib::GString> {
66 unsafe { from_glib_full(ffi::atk_plug_get_id(self.as_ref().to_glib_none().0)) }
67 }
68}
69
70impl<O: IsA<Plug>> AtkPlugExt for O {}