Struct gtk::SelectionData
source · [−]#[repr(transparent)]pub struct SelectionData { /* private fields */ }
Implementations
sourceimpl SelectionData
impl SelectionData
pub fn as_ptr(&self) -> *mut GtkSelectionData
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
sourcefn cmp(&self, other: &SelectionData) -> Ordering
fn cmp(&self, other: &SelectionData) -> Ordering
1.21.0 · sourceconst fn max(self, other: Self) -> Self
const fn max(self, other: Self) -> Self
1.21.0 · sourceconst fn min(self, other: Self) -> Self
const fn min(self, other: Self) -> Self
1.50.0 · sourceconst fn clamp(self, min: Self, max: Self) -> Selfwhere
Self: PartialOrd<Self>,
const fn clamp(self, min: Self, max: Self) -> Selfwhere
Self: PartialOrd<Self>,
sourceimpl PartialEq<SelectionData> for SelectionData
impl PartialEq<SelectionData> for SelectionData
sourcefn eq(&self, other: &SelectionData) -> bool
fn eq(&self, other: &SelectionData) -> bool
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>
1.0.0 · sourceconst fn le(&self, other: &Rhs) -> bool
const fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresourceimpl StaticType for SelectionData
impl StaticType for SelectionData
sourcefn static_type() -> Type
fn static_type() -> Type
Self
.