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 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162
// 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 crate::AccessibleProperty;
use crate::AccessibleRelation;
use crate::AccessibleRole;
use crate::AccessibleState;
use glib::object::Cast;
use glib::object::IsA;
use glib::signal::connect_raw;
use glib::signal::SignalHandlerId;
use glib::translate::*;
use glib::ToValue;
use std::boxed::Box as Box_;
use std::fmt;
use std::mem::transmute;
glib::wrapper! {
/// [`Accessible`][crate::Accessible] is an interface for describing UI elements for
/// Assistive Technologies.
///
/// Every accessible implementation has:
///
/// - a “role”, represented by a value of the [`AccessibleRole`][crate::AccessibleRole] enumeration
/// - an “attribute”, represented by a set of [`AccessibleState`][crate::AccessibleState],
/// [`AccessibleProperty`][crate::AccessibleProperty] and [`AccessibleRelation`][crate::AccessibleRelation] values
///
/// The role cannot be changed after instantiating a [`Accessible`][crate::Accessible]
/// implementation.
///
/// The attributes are updated every time a UI element's state changes in
/// a way that should be reflected by assistive technologies. For instance,
/// if a [`Widget`][crate::Widget] visibility changes, the [`AccessibleState::Hidden`][crate::AccessibleState::Hidden]
/// state will also change to reflect the `property::Widget::visible` property.
///
/// # Implements
///
/// [`AccessibleExt`][trait@crate::prelude::AccessibleExt], [`AccessibleExtManual`][trait@crate::prelude::AccessibleExtManual]
#[doc(alias = "GtkAccessible")]
pub struct Accessible(Interface<ffi::GtkAccessible, ffi::GtkAccessibleInterface>);
match fn {
type_ => || ffi::gtk_accessible_get_type(),
}
}
impl Accessible {
pub const NONE: Option<&'static Accessible> = None;
}
/// Trait containing all [`struct@Accessible`] methods.
///
/// # Implementors
///
/// [`AboutDialog`][struct@crate::AboutDialog], [`AccessibleRange`][struct@crate::AccessibleRange], [`Accessible`][struct@crate::Accessible], [`ActionBar`][struct@crate::ActionBar], [`AppChooserButton`][struct@crate::AppChooserButton], [`AppChooserDialog`][struct@crate::AppChooserDialog], [`AppChooserWidget`][struct@crate::AppChooserWidget], [`ApplicationWindow`][struct@crate::ApplicationWindow], [`AspectFrame`][struct@crate::AspectFrame], [`Assistant`][struct@crate::Assistant], [`Box`][struct@crate::Box], [`Button`][struct@crate::Button], [`Calendar`][struct@crate::Calendar], [`CellView`][struct@crate::CellView], [`CenterBox`][struct@crate::CenterBox], [`CheckButton`][struct@crate::CheckButton], [`ColorButton`][struct@crate::ColorButton], [`ColorChooserDialog`][struct@crate::ColorChooserDialog], [`ColorChooserWidget`][struct@crate::ColorChooserWidget], [`ColorDialogButton`][struct@crate::ColorDialogButton], [`ColumnView`][struct@crate::ColumnView], [`ComboBoxText`][struct@crate::ComboBoxText], [`ComboBox`][struct@crate::ComboBox], [`Dialog`][struct@crate::Dialog], [`DragIcon`][struct@crate::DragIcon], [`DrawingArea`][struct@crate::DrawingArea], [`DropDown`][struct@crate::DropDown], [`EditableLabel`][struct@crate::EditableLabel], [`EmojiChooser`][struct@crate::EmojiChooser], [`Entry`][struct@crate::Entry], [`Expander`][struct@crate::Expander], [`FileChooserDialog`][struct@crate::FileChooserDialog], [`FileChooserWidget`][struct@crate::FileChooserWidget], [`Fixed`][struct@crate::Fixed], [`FlowBoxChild`][struct@crate::FlowBoxChild], [`FlowBox`][struct@crate::FlowBox], [`FontButton`][struct@crate::FontButton], [`FontChooserDialog`][struct@crate::FontChooserDialog], [`FontChooserWidget`][struct@crate::FontChooserWidget], [`FontDialogButton`][struct@crate::FontDialogButton], [`Frame`][struct@crate::Frame], [`GLArea`][struct@crate::GLArea], [`GridView`][struct@crate::GridView], [`Grid`][struct@crate::Grid], [`HeaderBar`][struct@crate::HeaderBar], [`IconView`][struct@crate::IconView], [`Image`][struct@crate::Image], [`InfoBar`][struct@crate::InfoBar], [`Inscription`][struct@crate::Inscription], [`Label`][struct@crate::Label], [`LevelBar`][struct@crate::LevelBar], [`LinkButton`][struct@crate::LinkButton], [`ListBase`][struct@crate::ListBase], [`ListBoxRow`][struct@crate::ListBoxRow], [`ListBox`][struct@crate::ListBox], [`ListView`][struct@crate::ListView], [`LockButton`][struct@crate::LockButton], [`MediaControls`][struct@crate::MediaControls], [`MenuButton`][struct@crate::MenuButton], [`MessageDialog`][struct@crate::MessageDialog], [`Notebook`][struct@crate::Notebook], [`Overlay`][struct@crate::Overlay], [`PageSetupUnixDialog`][struct@crate::PageSetupUnixDialog], [`Paned`][struct@crate::Paned], [`PasswordEntry`][struct@crate::PasswordEntry], [`Picture`][struct@crate::Picture], [`PopoverMenuBar`][struct@crate::PopoverMenuBar], [`PopoverMenu`][struct@crate::PopoverMenu], [`Popover`][struct@crate::Popover], [`PrintUnixDialog`][struct@crate::PrintUnixDialog], [`ProgressBar`][struct@crate::ProgressBar], [`Range`][struct@crate::Range], [`Revealer`][struct@crate::Revealer], [`ScaleButton`][struct@crate::ScaleButton], [`Scale`][struct@crate::Scale], [`Scrollbar`][struct@crate::Scrollbar], [`ScrolledWindow`][struct@crate::ScrolledWindow], [`SearchBar`][struct@crate::SearchBar], [`SearchEntry`][struct@crate::SearchEntry], [`Separator`][struct@crate::Separator], [`ShortcutLabel`][struct@crate::ShortcutLabel], [`ShortcutsGroup`][struct@crate::ShortcutsGroup], [`ShortcutsSection`][struct@crate::ShortcutsSection], [`ShortcutsShortcut`][struct@crate::ShortcutsShortcut], [`ShortcutsWindow`][struct@crate::ShortcutsWindow], [`SpinButton`][struct@crate::SpinButton], [`Spinner`][struct@crate::Spinner], [`StackPage`][struct@crate::StackPage], [`StackSidebar`][struct@crate::StackSidebar], [`StackSwitcher`][struct@crate::StackSwitcher], [`Stack`][struct@crate::Stack], [`Statusbar`][struct@crate::Statusbar], [`Switch`][struct@crate::Switch], [`TextView`][struct@crate::TextView], [`Text`][struct@crate::Text], [`ToggleButton`][struct@crate::ToggleButton], [`TreeExpander`][struct@crate::TreeExpander], [`TreeView`][struct@crate::TreeView], [`Video`][struct@crate::Video], [`Viewport`][struct@crate::Viewport], [`VolumeButton`][struct@crate::VolumeButton], [`Widget`][struct@crate::Widget], [`WindowControls`][struct@crate::WindowControls], [`WindowHandle`][struct@crate::WindowHandle], [`Window`][struct@crate::Window]
pub trait AccessibleExt: 'static {
/// Retrieves the [`AccessibleRole`][crate::AccessibleRole] for the given [`Accessible`][crate::Accessible].
///
/// # Returns
///
/// a [`AccessibleRole`][crate::AccessibleRole]
#[doc(alias = "gtk_accessible_get_accessible_role")]
#[doc(alias = "get_accessible_role")]
fn accessible_role(&self) -> AccessibleRole;
/// Resets the accessible @property to its default value.
/// ## `property`
/// a [`AccessibleProperty`][crate::AccessibleProperty]
#[doc(alias = "gtk_accessible_reset_property")]
fn reset_property(&self, property: AccessibleProperty);
/// Resets the accessible @relation to its default value.
/// ## `relation`
/// a [`AccessibleRelation`][crate::AccessibleRelation]
#[doc(alias = "gtk_accessible_reset_relation")]
fn reset_relation(&self, relation: AccessibleRelation);
/// Resets the accessible @state to its default value.
/// ## `state`
/// a [`AccessibleState`][crate::AccessibleState]
#[doc(alias = "gtk_accessible_reset_state")]
fn reset_state(&self, state: AccessibleState);
/// The accessible role of the given [`Accessible`][crate::Accessible] implementation.
///
/// The accessible role cannot be changed once set.
#[doc(alias = "accessible-role")]
fn set_accessible_role(&self, accessible_role: AccessibleRole);
#[doc(alias = "accessible-role")]
fn connect_accessible_role_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
}
impl<O: IsA<Accessible>> AccessibleExt for O {
fn accessible_role(&self) -> AccessibleRole {
unsafe {
from_glib(ffi::gtk_accessible_get_accessible_role(
self.as_ref().to_glib_none().0,
))
}
}
fn reset_property(&self, property: AccessibleProperty) {
unsafe {
ffi::gtk_accessible_reset_property(
self.as_ref().to_glib_none().0,
property.into_glib(),
);
}
}
fn reset_relation(&self, relation: AccessibleRelation) {
unsafe {
ffi::gtk_accessible_reset_relation(
self.as_ref().to_glib_none().0,
relation.into_glib(),
);
}
}
fn reset_state(&self, state: AccessibleState) {
unsafe {
ffi::gtk_accessible_reset_state(self.as_ref().to_glib_none().0, state.into_glib());
}
}
fn set_accessible_role(&self, accessible_role: AccessibleRole) {
glib::ObjectExt::set_property(self.as_ref(), "accessible-role", &accessible_role)
}
fn connect_accessible_role_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_accessible_role_trampoline<
P: IsA<Accessible>,
F: Fn(&P) + 'static,
>(
this: *mut ffi::GtkAccessible,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(Accessible::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"notify::accessible-role\0".as_ptr() as *const _,
Some(transmute::<_, unsafe extern "C" fn()>(
notify_accessible_role_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
}
impl fmt::Display for Accessible {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.write_str("Accessible")
}
}