Skip to main content

SelectionData

Struct SelectionData 

Source
pub struct SelectionData { /* private fields */ }

Implementations§

Source§

impl SelectionData

Source

pub fn as_ptr(&self) -> *mut GtkSelectionData

Return the inner pointer to the underlying C value.

Source

pub unsafe fn from_glib_ptr_borrow<'a>( ptr: *const *const GtkSelectionData, ) -> &'a Self

Borrows the underlying C value.

Source

pub unsafe fn from_glib_ptr_borrow_mut<'a>( ptr: *mut *mut GtkSelectionData, ) -> &'a mut Self

Borrows the underlying C value mutably.

Source§

impl SelectionData

Source

pub fn data_type(&self) -> Atom

Retrieves the data type of the selection.

§Returns

the data type of the selection.

Source

pub fn display(&self) -> Option<Display>

Retrieves the display of the selection.

§Returns

the display of the selection.

Source

pub fn format(&self) -> i32

Retrieves the format of the selection.

§Returns

the format of the selection.

Source

pub fn length(&self) -> i32

Retrieves the length of the raw data of the selection.

§Returns

the length of the data of the selection.

Source

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().

Source

pub fn selection(&self) -> Atom

Retrieves the selection gdk::Atom of the selection data.

§Returns

the selection gdk::Atom of the selection data.

Source

pub fn target(&self) -> Atom

Retrieves the target of the selection.

§Returns

the target of the selection.

Source

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().

Source

pub fn text(&self) -> Option<GString>

Gets the contents of the selection data as a UTF-8 string.

§Returns

if the selection data contained a recognized text type and it could be converted to UTF-8, a newly allocated string containing the converted text, otherwise None. If the result is non-None it must be freed with g_free().

Source

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().

Source

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)

Source

pub fn set_pixbuf(&self, pixbuf: &Pixbuf) -> bool

Sets the contents of the selection from a gdk_pixbuf::Pixbuf The pixbuf is converted to the form determined by self->target.

§pixbuf

a gdk_pixbuf::Pixbuf

§Returns

true if the selection was successfully set, otherwise false.

Source

pub fn set_text(&self, str: &str) -> bool

Sets the contents of the selection from a UTF-8 encoded string. The string is converted to the form determined by self->target.

§str

a UTF-8 string

§len

the length of str, or -1 if str is nul-terminated.

§Returns

true if the selection was successfully set, otherwise false.

Source

pub fn set_uris(&self, uris: &[&str]) -> bool

Sets the contents of the selection from a list of URIs. The string is converted to the form determined by self->target.

Since 3.24.37, this may involve using the FileTransfer portal to send files between sandboxed apps.

§uris

a None-terminated array of strings holding URIs

§Returns

true if the selection was successfully set, otherwise false.

Source

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.

Source

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

a TextBuffer

§Returns

true if self holds a list of targets, and a suitable target for rich text is included, otherwise false.

Source

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.

Source

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.

Source§

impl SelectionData

Source

pub fn data(&self) -> Vec<u8>

Retrieves the raw data of the selection.

§Returns

the raw data of the selection.

Trait Implementations§

Source§

impl Clone for SelectionData

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SelectionData

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for SelectionData

Source§

impl From<SelectionData> for Value

Source§

fn from(o: SelectionData) -> Self

Converts to this type from the input type.
Source§

impl HasParamSpec for SelectionData

Source§

type ParamSpec = ParamSpecBoxed

Source§

type SetValue = SelectionData

Preferred value to be used as setter for the associated ParamSpec.
Source§

type BuilderFn = fn(&str) -> ParamSpecBoxedBuilder<'_, SelectionData>

Source§

fn param_spec_builder() -> Self::BuilderFn

Source§

impl Hash for SelectionData

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Ord for SelectionData

Source§

fn cmp(&self, other: &SelectionData) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 (const: unstable) · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 (const: unstable) · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for SelectionData

Source§

fn eq(&self, other: &SelectionData) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl PartialOrd for SelectionData

Source§

fn partial_cmp(&self, other: &SelectionData) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 (const: unstable) · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 (const: unstable) · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 (const: unstable) · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 (const: unstable) · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl StaticType for SelectionData

Source§

fn static_type() -> Type

Returns the type identifier of Self.
Source§

impl StructuralPartialEq for SelectionData

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GList> for T

Source§

unsafe fn from_glib_none_num_as_vec(ptr: *const GList, num: usize) -> Vec<T>

Source§

unsafe fn from_glib_container_num_as_vec(_: *const GList, _: usize) -> Vec<T>

Source§

unsafe fn from_glib_full_num_as_vec(_: *const GList, _: usize) -> Vec<T>

Source§

impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GPtrArray> for T

Source§

unsafe fn from_glib_none_num_as_vec(ptr: *const GPtrArray, num: usize) -> Vec<T>

Source§

unsafe fn from_glib_container_num_as_vec( _: *const GPtrArray, _: usize, ) -> Vec<T>

Source§

unsafe fn from_glib_full_num_as_vec(_: *const GPtrArray, _: usize) -> Vec<T>

Source§

impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GSList> for T

Source§

unsafe fn from_glib_none_num_as_vec(ptr: *const GSList, num: usize) -> Vec<T>

Source§

unsafe fn from_glib_container_num_as_vec(_: *const GSList, _: usize) -> Vec<T>

Source§

unsafe fn from_glib_full_num_as_vec(_: *const GSList, _: usize) -> Vec<T>

Source§

impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GList> for T

Source§

unsafe fn from_glib_none_num_as_vec(ptr: *mut GList, num: usize) -> Vec<T>

Source§

unsafe fn from_glib_container_num_as_vec(ptr: *mut GList, num: usize) -> Vec<T>

Source§

unsafe fn from_glib_full_num_as_vec(ptr: *mut GList, num: usize) -> Vec<T>

Source§

impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GPtrArray> for T

Source§

unsafe fn from_glib_none_num_as_vec(ptr: *mut GPtrArray, num: usize) -> Vec<T>

Source§

unsafe fn from_glib_container_num_as_vec( ptr: *mut GPtrArray, num: usize, ) -> Vec<T>

Source§

unsafe fn from_glib_full_num_as_vec(ptr: *mut GPtrArray, num: usize) -> Vec<T>

Source§

impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GSList> for T

Source§

unsafe fn from_glib_none_num_as_vec(ptr: *mut GSList, num: usize) -> Vec<T>

Source§

unsafe fn from_glib_container_num_as_vec(ptr: *mut GSList, num: usize) -> Vec<T>

Source§

unsafe fn from_glib_full_num_as_vec(ptr: *mut GSList, num: usize) -> Vec<T>

Source§

impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GList> for T

Source§

unsafe fn from_glib_none_as_vec(ptr: *const GList) -> Vec<T>

Source§

unsafe fn from_glib_container_as_vec(_: *const GList) -> Vec<T>

Source§

unsafe fn from_glib_full_as_vec(_: *const GList) -> Vec<T>

Source§

impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GPtrArray> for T

Source§

unsafe fn from_glib_none_as_vec(ptr: *const GPtrArray) -> Vec<T>

Source§

unsafe fn from_glib_container_as_vec(_: *const GPtrArray) -> Vec<T>

Source§

unsafe fn from_glib_full_as_vec(_: *const GPtrArray) -> Vec<T>

Source§

impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GSList> for T

Source§

unsafe fn from_glib_none_as_vec(ptr: *const GSList) -> Vec<T>

Source§

unsafe fn from_glib_container_as_vec(_: *const GSList) -> Vec<T>

Source§

unsafe fn from_glib_full_as_vec(_: *const GSList) -> Vec<T>

Source§

impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GList> for T

Source§

unsafe fn from_glib_none_as_vec(ptr: *mut GList) -> Vec<T>

Source§

unsafe fn from_glib_container_as_vec(ptr: *mut GList) -> Vec<T>

Source§

unsafe fn from_glib_full_as_vec(ptr: *mut GList) -> Vec<T>

Source§

impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GPtrArray> for T

Source§

unsafe fn from_glib_none_as_vec(ptr: *mut GPtrArray) -> Vec<T>

Source§

unsafe fn from_glib_container_as_vec(ptr: *mut GPtrArray) -> Vec<T>

Source§

unsafe fn from_glib_full_as_vec(ptr: *mut GPtrArray) -> Vec<T>

Source§

impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GSList> for T

Source§

unsafe fn from_glib_none_as_vec(ptr: *mut GSList) -> Vec<T>

Source§

unsafe fn from_glib_container_as_vec(ptr: *mut GSList) -> Vec<T>

Source§

unsafe fn from_glib_full_as_vec(ptr: *mut GSList) -> Vec<T>

Source§

impl<'a, T, C, E> FromValueOptional<'a> for T
where T: FromValue<'a, Checker = C>, C: ValueTypeChecker<Error = ValueTypeMismatchOrNoneError<E>>, E: Error + Send + 'static,

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoClosureReturnValue for T
where T: Into<Value>,

Source§

impl<T> Property for T
where T: HasParamSpec,

Source§

type Value = T

Source§

impl<T> PropertyGet for T
where T: HasParamSpec,

Source§

type Value = T

Source§

fn get<R, F>(&self, f: F) -> R
where F: Fn(&<T as PropertyGet>::Value) -> R,

Source§

impl<T> StaticTypeExt for T
where T: StaticType,

Source§

fn ensure_type()

Ensures that the type has been registered with the type system.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> TransparentType for T

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T> TryFromClosureReturnValue for T
where T: for<'a> FromValue<'a> + StaticType + 'static,

Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.