pub struct SelectionData { /* private fields */ }Expand description
GLib type: Boxed type with copy-on-clone semantics.
Implementations§
Source§impl SelectionData
impl SelectionData
Sourcepub fn as_ptr(&self) -> *mut GtkSelectionData
pub fn as_ptr(&self) -> *mut GtkSelectionData
Return the inner pointer to the underlying C value.
Sourcepub unsafe fn from_glib_ptr_borrow(ptr: &*mut GtkSelectionData) -> &Self
pub unsafe fn from_glib_ptr_borrow(ptr: &*mut GtkSelectionData) -> &Self
Borrows the underlying C value.
Sourcepub unsafe fn from_glib_ptr_borrow_mut(
ptr: &mut *mut GtkSelectionData,
) -> &mut Self
pub unsafe fn from_glib_ptr_borrow_mut( ptr: &mut *mut GtkSelectionData, ) -> &mut Self
Borrows the underlying C value mutably.
Source§impl SelectionData
impl SelectionData
Sourcepub fn length(&self) -> i32
pub fn length(&self) -> i32
Retrieves the length of the raw data of the selection.
§Returns
the length of the data of the selection.
Sourcepub fn pixbuf(&self) -> Option<Pixbuf>
pub fn pixbuf(&self) -> Option<Pixbuf>
Gets the contents of the selection data as a gdk_pixbuf::Pixbuf.
§Returns
if the selection data
contained a recognized image type and it could be converted to a
gdk_pixbuf::Pixbuf, a newly allocated pixbuf is returned, otherwise
None. If the result is non-None it must be freed with
g_object_unref().
Sourcepub fn targets(&self) -> Option<Vec<Atom>>
pub fn targets(&self) -> Option<Vec<Atom>>
Gets the contents of self as an array of targets.
This can be used to interpret the results of getting
the standard TARGETS target that is always supplied for
any selection.
§Returns
true if self contains a valid
array of targets, otherwise false.
§targets
location to store an array of targets. The result stored
here must be freed with g_free().
Sourcepub fn uris(&self) -> Vec<GString>
pub fn uris(&self) -> Vec<GString>
Gets the contents of the selection data as array of URIs.
Since 3.24.37, this may involve using the FileTransfer portal to send files between sandboxed apps.
§Returns
if
the selection data contains a list of
URIs, a newly allocated None-terminated string array
containing the URIs, otherwise None. If the result is
non-None it must be freed with g_strfreev().
Sourcepub fn set(&self, type_: &Atom, format: i32, data: &[u8])
pub fn set(&self, type_: &Atom, format: i32, data: &[u8])
Stores new data into a SelectionData object. Should
only be called from a selection handler callback.
Zero-terminates the stored data.
§type_
the type of selection data
§format
format (number of bits in a unit)
§data
pointer to the data (will be copied)
Sourcepub fn set_pixbuf(&self, pixbuf: &Pixbuf) -> bool
pub fn set_pixbuf(&self, pixbuf: &Pixbuf) -> bool
Sourcepub fn targets_include_image(&self, writable: bool) -> bool
pub fn targets_include_image(&self, writable: bool) -> bool
Given a SelectionData object holding a list of targets,
determines if any of the targets in targets can be used to
provide a gdk_pixbuf::Pixbuf.
§writable
whether to accept only targets for which GTK+ knows how to convert a pixbuf into the format
§Returns
true if self holds a list of targets,
and a suitable target for images is included, otherwise false.
Sourcepub fn targets_include_rich_text(&self, buffer: &impl IsA<TextBuffer>) -> bool
pub fn targets_include_rich_text(&self, buffer: &impl IsA<TextBuffer>) -> bool
Given a SelectionData object holding a list of targets,
determines if any of the targets in targets can be used to
provide rich text.
§buffer
§Returns
true if self holds a list of targets,
and a suitable target for rich text is included,
otherwise false.
Sourcepub fn targets_include_text(&self) -> bool
pub fn targets_include_text(&self) -> bool
Given a SelectionData object holding a list of targets,
determines if any of the targets in targets can be used to
provide text.
§Returns
true if self holds a list of targets,
and a suitable target for text is included, otherwise false.
Sourcepub fn targets_include_uri(&self) -> bool
pub fn targets_include_uri(&self) -> bool
Given a SelectionData object holding a list of targets,
determines if any of the targets in targets can be used to
provide a list or URIs.
§Returns
true if self holds a list of targets,
and a suitable target for URI lists is included, otherwise false.
Trait Implementations§
Source§impl Clone for SelectionData
impl Clone for SelectionData
Source§impl Debug for SelectionData
impl Debug for SelectionData
impl Eq for SelectionData
Source§impl From<SelectionData> for Value
impl From<SelectionData> for Value
Source§fn from(o: SelectionData) -> Self
fn from(o: SelectionData) -> Self
Source§impl HasParamSpec for SelectionData
impl HasParamSpec for SelectionData
type ParamSpec = ParamSpecBoxed
Source§type SetValue = SelectionData
type SetValue = SelectionData
type BuilderFn = fn(&str) -> ParamSpecBoxedBuilder<'_, SelectionData>
fn param_spec_builder() -> Self::BuilderFn
Source§impl Hash for SelectionData
impl Hash for SelectionData
Source§impl Ord for SelectionData
impl Ord for SelectionData
Source§fn cmp(&self, other: &SelectionData) -> Ordering
fn cmp(&self, other: &SelectionData) -> Ordering
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for SelectionData
impl PartialEq for SelectionData
Source§impl PartialOrd for SelectionData
impl PartialOrd for SelectionData
Source§impl StaticType for SelectionData
impl StaticType for SelectionData
Source§fn static_type() -> Type
fn static_type() -> Type
Self.