gtkmm
3.95.1
|
Drag-and-drop functions. More...
Functions | |
Widget* | get_source_widget (const Glib::RefPtr< Gdk::Drag >& drag) |
Determines the source widget for a drag. More... | |
void | cancel (const Glib::RefPtr< Gdk::Drag >& drag) |
Cancels an ongoing drag operation on the source side. More... | |
void | set_icon (const Glib::RefPtr< Gdk::Drag >& drag, Widget& widget, int hot_x=0, int hot_y=0) |
Changes the icon for drag operation to a given widget. More... | |
void | set_icon (const Glib::RefPtr< Gdk::Drag >& drag, const Glib::RefPtr< Gdk::Paintable >& paintable, int hot_x=0, int hot_y=0) |
Sets paintable as the icon for a given drag. More... | |
void | set_icon (const Glib::RefPtr< Gdk::Drag >& drag, const Glib::ustring& icon_name, int hot_x=0, int hot_y=0) |
Sets the icon for a given drag from a named themed icon. More... | |
void | set_icon (const Glib::RefPtr< Gdk::Drag >& drag, const Glib::RefPtr< Gio::Icon >& icon, int hot_x=0, int hot_y=0) |
Sets the icon for a given drag from the given icon. More... | |
void | set_icon (const Glib::RefPtr< Gdk::Drag >& drag) |
Sets the icon for a particular drag to the default icon. More... | |
Drag-and-drop functions.
The Gtk::DnD namespace contains functions that logically are Gdk::Drag methods. However, they can't be members of Gdk::Drag, because they depend on code in the gtk part of gtk+. Such a dependency is not allowed in a Gdk class.
void Gtk::DnD::cancel | ( | const Glib::RefPtr< Gdk::Drag >& | drag | ) |
Cancels an ongoing drag operation on the source side.
If you want to be able to cancel a drag operation in this way, you need to keep a reference to the Gdk::Drag instance, either from an explicit call to Gtk::Widget::drag_begin(), or by connecting to Gtk::Widget::signal_drag_begin().
If drag does not refer to an ongoing drag operation, this function does nothing.
If a drag is cancelled in this way, the result argument of Gtk::Widget::signal_drag_failed() is set to Gtk::DragResult::ERROR.
drag | A Gdk::Drag instance, as e.g. returned by Gtk::Widget::drag_begin(). |
Widget* Gtk::DnD::get_source_widget | ( | const Glib::RefPtr< Gdk::Drag >& | drag | ) |
Determines the source widget for a drag.
drag | A Gdk::Drag instance. |
void Gtk::DnD::set_icon | ( | const Glib::RefPtr< Gdk::Drag >& | drag, |
Widget& | widget, | ||
int | hot_x = 0 , |
||
int | hot_y = 0 |
||
) |
Changes the icon for drag operation to a given widget.
GTK+ will not destroy the widget, so if you don’t want it to persist, you should connect to Gtk::Widget::signal_drag_end() and destroy it yourself.
drag | A Gdk::Drag instance. |
widget | A widget to use as an icon. |
hot_x | The X offset within widget of the hotspot. |
hot_y | The Y offset within widget of the hotspot. |
void Gtk::DnD::set_icon | ( | const Glib::RefPtr< Gdk::Drag >& | drag, |
const Glib::RefPtr< Gdk::Paintable >& | paintable, | ||
int | hot_x = 0 , |
||
int | hot_y = 0 |
||
) |
Sets paintable as the icon for a given drag.
To position the paintable relative to the mouse, its top left will be positioned hot_x, hot_y pixels from the mouse cursor.
drag | A Gdk::Drag instance. |
paintable | The Gdk::Paintable to use as icon. |
hot_x | The X offset of the hotspot within the icon. |
hot_y | The Y offset of the hotspot within the icon. |
void Gtk::DnD::set_icon | ( | const Glib::RefPtr< Gdk::Drag >& | drag, |
const Glib::ustring & | icon_name, | ||
int | hot_x = 0 , |
||
int | hot_y = 0 |
||
) |
Sets the icon for a given drag from a named themed icon.
See the docs for Gtk::IconTheme for more details. Note that the size of the icon depends on the icon theme (the icon is loaded at the symbolic size Gtk::IconSize::INHERIT), thus hot_x and hot_y have to be used with care.
drag | A Gdk::Drag instance. |
icon_name | Name of icon to use. |
hot_x | The X offset of the hotspot within the icon. |
hot_y | The Y offset of the hotspot within the icon. |
void Gtk::DnD::set_icon | ( | const Glib::RefPtr< Gdk::Drag >& | drag, |
const Glib::RefPtr< Gio::Icon > & | icon, | ||
int | hot_x = 0 , |
||
int | hot_y = 0 |
||
) |
Sets the icon for a given drag from the given icon.
See the documentation for Gtk::DnD::set_icon(const Glib::RefPtr<Gdk::Drag>& drag, const Glib::ustring& icon_name, int hot_x, int hot_y) for more details about using icons in drag and drop.
void Gtk::DnD::set_icon | ( | const Glib::RefPtr< Gdk::Drag >& | drag | ) |
Sets the icon for a particular drag to the default icon.
drag | A Gdk::Drag instance. |