Struct gtk::SelectionData
source · [−]#[repr(transparent)]pub struct SelectionData { /* private fields */ }
Implementations
sourceimpl 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 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
Sets the contents of the selection from a gdk_pixbuf::Pixbuf
The pixbuf is converted to the form determined by
self
->target.
pixbuf
Returns
true
if the selection was successfully set,
otherwise false
.
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
sourceimpl Clone for SelectionData
impl Clone for SelectionData
sourceimpl Debug for SelectionData
impl Debug for SelectionData
sourceimpl Hash for SelectionData
impl Hash for SelectionData
sourceimpl Ord for SelectionData
impl Ord for SelectionData
sourceimpl PartialEq<SelectionData> for SelectionData
impl PartialEq<SelectionData> for SelectionData
sourcefn eq(&self, other: &SelectionData) -> bool
fn eq(&self, other: &SelectionData) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &SelectionData) -> bool
fn ne(&self, other: &SelectionData) -> bool
This method tests for !=
.
sourceimpl PartialOrd<SelectionData> for SelectionData
impl PartialOrd<SelectionData> for SelectionData
sourcefn partial_cmp(&self, other: &SelectionData) -> Option<Ordering>
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 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl StaticType for SelectionData
impl StaticType for SelectionData
sourcefn static_type() -> Type
fn static_type() -> Type
Returns the type identifier of Self
.
impl Eq for SelectionData
impl StructuralEq for SelectionData
impl StructuralPartialEq for SelectionData
Auto Trait Implementations
impl RefUnwindSafe for SelectionData
impl !Send for SelectionData
impl !Sync for SelectionData
impl Unpin for SelectionData
impl UnwindSafe for SelectionData
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> StaticTypeExt for T where
T: StaticType,
impl<T> StaticTypeExt for T where
T: StaticType,
sourcefn ensure_type()
fn ensure_type()
Ensures that the type has been registered with the type system.
sourceimpl<T> ToClosureReturnValue for T where
T: ToValue,
impl<T> ToClosureReturnValue for T where
T: ToValue,
fn to_closure_return_value(&self) -> Option<Value>
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more