Gtk2::S...tionData(3)

πŸ“¦
version 1.24993 Β· 2 versions
, in fedora 43

πŸ’– Gtk2::SelectionData β€” the wrapper for GtkSelectionData πŸ’–

okay bestie, so this is Gtk2::SelectionData, a Perl wrapper situation for GtkSelectionData β€” like, the thing that carries clipboard/selection data around in GTK land. She's from the User Contributed Perl Documentation corner of the internet and she is serving. Let's get into it ✨


πŸ¦‹ HIERARCHY πŸ¦‹

the family tree, she's a nepo baby but make it boxed:

Glib::Boxed
+----Gtk2::SelectionData

so yeah, Gtk2::SelectionData is a child of Glib::Boxed. iconic lineage tbh πŸ‘‘


✨ METHODS ✨

scalar = $d->get_data

gets you the data, as a scalar. simple. clean. πŸ’…

scalar = $d->get_data_type

hands you the data type. it's giving scalar. 🌟

scalar = $d->get_display

the display. scalar. we love a one-word answer. 🫢

scalar = $d->get_format

the format, as a scalar. no cap.

$selection_data->set ($type, $format, $data)

sets the whole thing up. here's what you're feeding her:

  • $type β€” a Gtk2::Gdk::Atom πŸ“
  • $format β€” an integer
  • $data β€” a Glib::UChar

scalar = $d->get_length

the length. scalar. that's it, that's the tweet. πŸ’€

pixbuf or undef = $selection_data->get_pixbuf

you get a pixbuf… or undef, bestie, it's giving mystery πŸ™ˆ

Since: gtk+ 2.6 ✨

boolean = $selection_data->set_pixbuf ($pixbuf)

  • $pixbuf β€” a Gtk2::Gdk::Pixbuf πŸŽ€
Since: gtk+ 2.6 ✨

(tree_model, path) = $selection_data->get_row_drag_data

okay so the tea here: if $selection_data is not of target type GTK_TREE_MODEL_ROW, then the return is an empty list. that's the whole rule. periodt. πŸ’…

boolean = $selection_data->set_row_drag_data ($tree_model, $path)

  • $tree_model β€” a Gtk2::TreeModel 🌈
  • $path β€” a Gtk2::TreePath πŸ¦‹

scalar = $d->get_selection

scalar. the selection. you know the vibe. ✨

scalar = $d->get_target

scalar. the target. 🎯

list = $selection_data->get_targets

so this one grabs the contents of selection_data as an array of targets. main character energy. you'd use this to interpret the results of getting the standard TARGETS target β€” which, btw, is always supplied for any selection. like, always always. πŸ‘‘

Returns a list of GdkAtoms, the targets. πŸ’–

boolean = $selection_data->targets_include_image ($writable)

  • $writable β€” a boolean 🌸
Since: gtk+ 2.6 ✨

boolean = $selection_data->targets_include_rich_text ($buffer)

  • $buffer β€” a Gtk2::TextBuffer πŸ“
Since: gtk+ 2.10 ✨

boolean = $selection_data->targets_include_text

does it include text? boolean. yes or no, no in-between. πŸ’…

boolean = $selection_data->targets_include_uri

does it include a URI? boolean. again, binary decision. πŸ¦‹

Since: gtk+ 2.10 ✨

string = $selection_data->get_text

gives you the text. as a string. slay. ✨

boolean = $selection_data->set_text ($str, $len=-1)

  • $str β€” a string πŸ“
  • $len β€” an integer, and she defaults to -1 if you don't say anything πŸŽ€

list = $selection_data->get_uris

a whole list of URIs, bestie. 🌈

Since: gtk+ 2.6 ✨

boolean = $selection_data->set_uris (...)

  • ... β€” a list of strings πŸ’œ
Since: gtk+ 2.6 ✨

πŸ‘€ SEE ALSO πŸ‘€

go read these next, fr fr:

  • Gtk2
  • Glib::Boxed

Copyright (C) 2003-2011 by the gtk2-perl team.

This software is licensed under the LGPL. See Gtk2 for a full notice. 🫢


and that's the whole page, babe πŸ’– this was documented by the gtk2-perl girlies, generated with perl v5.42.0 on 2025-07-25, and it's literally the Gtk2::S...tionData(3) page. you ate that πŸŒˆβœ¨πŸ’…

πŸ“¦ where this page comes from