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
// 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::IsA; use glib::translate::*; use glib::GString; use std::fmt; use std::mem; use CoordType; glib_wrapper! { /// `Image` should be implemented by `Object` subtypes on behalf of /// components which display image/pixmap information onscreen, and /// which provide information (other than just widget borders, etc.) /// via that image content. For instance, icons, buttons with icons, /// toolbar elements, and image viewing panes typically should /// implement `Image`. /// /// `Image` primarily provides two types of information: coordinate /// information (useful for screen review mode of screenreaders, and /// for use by onscreen magnifiers), and descriptive information. The /// descriptive information is provided for alternative, text-only /// presentation of the most significant information present in the /// image. /// /// # Implements /// /// [`AtkImageExt`](trait.AtkImageExt.html) pub struct Image(Interface<atk_sys::AtkImage>); match fn { get_type => || atk_sys::atk_image_get_type(), } } pub const NONE_IMAGE: Option<&Image> = None; /// Trait containing all `Image` methods. /// /// # Implementors /// /// [`Image`](struct.Image.html), [`NoOpObject`](struct.NoOpObject.html) pub trait AtkImageExt: 'static { /// Get a textual description of this image. /// /// # Returns /// /// a string representing the image description fn get_image_description(&self) -> Option<GString>; /// Retrieves the locale identifier associated to the `Image`. /// /// # Returns /// /// a string corresponding to the POSIX /// `LC_MESSAGES` locale used by the image description, or /// `None` if the image does not specify a locale. fn get_image_locale(&self) -> Option<GString>; /// Gets the position of the image in the form of a point specifying the /// images top-left corner. /// ## `x` /// address of `gint` to put x coordinate position; otherwise, -1 if value cannot be obtained. /// ## `y` /// address of `gint` to put y coordinate position; otherwise, -1 if value cannot be obtained. /// ## `coord_type` /// specifies whether the coordinates are relative to the screen /// or to the components top level window fn get_image_position(&self, coord_type: CoordType) -> (i32, i32); /// Get the width and height in pixels for the specified image. /// The values of `width` and `height` are returned as -1 if the /// values cannot be obtained (for instance, if the object is not onscreen). /// ## `width` /// filled with the image width, or -1 if the value cannot be obtained. /// ## `height` /// filled with the image height, or -1 if the value cannot be obtained. fn get_image_size(&self) -> (i32, i32); /// Sets the textual description for this image. /// ## `description` /// a string description to set for `self` /// /// # Returns /// /// boolean TRUE, or FALSE if operation could /// not be completed. fn set_image_description(&self, description: &str) -> bool; } impl<O: IsA<Image>> AtkImageExt for O { fn get_image_description(&self) -> Option<GString> { unsafe { from_glib_none(atk_sys::atk_image_get_image_description( self.as_ref().to_glib_none().0, )) } } fn get_image_locale(&self) -> Option<GString> { unsafe { from_glib_none(atk_sys::atk_image_get_image_locale( self.as_ref().to_glib_none().0, )) } } fn get_image_position(&self, coord_type: CoordType) -> (i32, i32) { unsafe { let mut x = mem::MaybeUninit::uninit(); let mut y = mem::MaybeUninit::uninit(); atk_sys::atk_image_get_image_position( self.as_ref().to_glib_none().0, x.as_mut_ptr(), y.as_mut_ptr(), coord_type.to_glib(), ); let x = x.assume_init(); let y = y.assume_init(); (x, y) } } fn get_image_size(&self) -> (i32, i32) { unsafe { let mut width = mem::MaybeUninit::uninit(); let mut height = mem::MaybeUninit::uninit(); atk_sys::atk_image_get_image_size( self.as_ref().to_glib_none().0, width.as_mut_ptr(), height.as_mut_ptr(), ); let width = width.assume_init(); let height = height.assume_init(); (width, height) } } fn set_image_description(&self, description: &str) -> bool { unsafe { from_glib(atk_sys::atk_image_set_image_description( self.as_ref().to_glib_none().0, description.to_glib_none().0, )) } } } impl fmt::Display for Image { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "Image") } }