gtkmm 3.22.1

Public Member Functions | Static Public Member Functions | Related Functions | List of all members
Gdk::DragContext Class Reference

A Gdk::DragContext holds information about a drag in progress. More...

`#include <gdkmm/dragcontext.h>`

Inheritance diagram for Gdk::DragContext:
[legend]

## Public Member Functions
| DragContext (DragContext&& src) noexcept
DragContext& | operator= (DragContext&& src) noexcept
| ~DragContext () noexcept override
GdkDragContext* | gobj ()
| Provides access to the underlying C GObject. More...
const GdkDragContext* | gobj () const
| Provides access to the underlying C GObject. More...
GdkDragContext* | gobj_copy ()
| Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. More...
void | drag_status (DragAction action, guint32 time)
| Selects one of the actions offered by the drag source. More...
void | drag_refuse (guint32 time)
| Indicate that a drop will not be accepted. More...
void | drop_reply (bool accepted, guint32 time)
| Accepts or rejects a drop. More...
void | drop_finish (bool success, guint32 time)
| Ends the drag operation after a drop. More...
Glib::ustring | get_selection () const
| Returns the selection atom for the current source window. More...
void | drag_finish (bool success, bool del, guint32 time)
| Informs the drag source that the drop is finished, and that the data of the drag will no longer be required. More...
void | set_icon (const ::Cairo::RefPtr< ::Cairo::Surface >& surface)
void | set_icon (const Glib::RefPtr< Gdk::Pixbuf >& pixbuf, int hot_x, int hot_y)
void | set_icon (const Glib::ustring& stock_id, int hot_x, int hot_y)
void | set_icon_name (const Glib::ustring& name, int hot_x, int hot_y)
void | set_icon ()
Glib::RefPtr< Window > | get_source_window ()
| Returns the Gdk::Window where the DND operation started. More...
Glib::RefPtr< const Window > | get_source_window () const
| Returns the Gdk::Window where the DND operation started. More...
Glib::RefPtr< Window > | get_dest_window ()
| Returns the destination windw for the DND operation. More...
Glib::RefPtr< const Window > | get_dest_window () const
| Returns the destination windw for the DND operation. More...
DragProtocol | get_protocol () const
| Returns the drag protocol thats used by this context. More...
void | set_device (const Glib::RefPtr< Device >& device)
| Associates a Gdk::Device to context, so all Drag and Drop events for context are emitted as if they came from this device. More...
Glib::RefPtr< Device > | get_device ()
| Returns the Gdk::Device associated to the drag context. More...
Glib::RefPtr< const Device > | get_device () const
| Returns the Gdk::Device associated to the drag context. More...
std::vector< std::string > | list_targets () const
| Get a list of targets offered by the source. More...
DragAction | get_actions () const
| Determines the bitmask of actions proposed by the source if get_suggested_action() returns Gdk::ACTION_ASK. More...
DragAction | get_suggested_action () const
| Determines the suggested drag action of the context. More...
DragAction | get_selected_action () const
| Determines the action chosen by the drag destination. More...
void | find_window_for_screen (const Glib::RefPtr< Window >& drag_window, const Glib::RefPtr< Screen >& screen, int x_root, int y_root, Glib::RefPtr< Window >& dest_window, DragProtocol& protocol) const
| Finds the destination window and DND protocol to use at the given pointer position. More...
Public Member Functions inherited from Glib::Object
| Object (const Object &)=delete
Object & | operator= (const Object &)=delete
| Object (Object &&src) noexcept
Object & | operator= (Object &&src) noexcept
void * | get_data (const QueryQuark &key)
void | set_data (const Quark &key, void *data)
void | set_data (const Quark &key, void *data, DestroyNotify notify)
void | remove_data (const QueryQuark &quark)
void * | steal_data (const QueryQuark &quark)
Glib::RefPtr< Glib::Object > | wrap (GObject *object, bool take_copy=false)
Public Member Functions inherited from Glib::ObjectBase
| ObjectBase (const ObjectBase &)=delete
ObjectBase & | operator= (const ObjectBase &)=delete
void | set_property_value (const Glib::ustring &property_name, const Glib::ValueBase &value)
void | get_property_value (const Glib::ustring &property_name, Glib::ValueBase &value) const
void | set_property (const Glib::ustring &property_name, const PropertyType &value)
void | get_property (const Glib::ustring &property_name, PropertyType &value) const
void | connect_property_changed (const Glib::ustring &property_name, const sigc::slot< void > &slot)
void | connect_property_changed (const Glib::ustring &property_name, sigc::slot< void > &&slot)
sigc::connection | connect_property_changed_with_return (const Glib::ustring &property_name, const sigc::slot< void > &slot)
sigc::connection | connect_property_changed_with_return (const Glib::ustring &property_name, sigc::slot< void > &&slot)
void | freeze_notify ()
void | thaw_notify ()
virtual void | reference () const
virtual void | unreference () const
GObject * | gobj ()
const GObject * | gobj () const
GObject * | gobj_copy () const
Public Member Functions inherited from sigc::trackable
| trackable () noexcept
| trackable (const trackable &src) noexcept
| trackable (trackable &&src)
| ~trackable ()
void | add_destroy_notify_callback (void *data, func_destroy_notify func) const
void | notify_callbacks ()
trackable & | operator= (const trackable &src)
trackable & | operator= (trackable &&src)
void | remove_destroy_notify_callback (void *data) const

## Static Public Member Functions
static GType | get_type ()
| Get the GType for this class, for use with the underlying GObject type system. More...

## Related Functions
(Note that these are not member functions.)
Glib::RefPtr< Gdk::DragContext > | wrap (GdkDragContext* object, bool take_copy=false)
| A Glib::wrap() method for this object. More...

## Additional Inherited Members
Public Types inherited from Glib::Object
typedef void(*)(gpointer data | DestroyNotify)
Public Types inherited from sigc::trackable
typedef internal::func_destroy_notify | func_destroy_notify
Protected Member Functions inherited from Glib::Object
| Object ()
| Object (const Glib::ConstructParams &construct_params)
| Object (GObject *castitem)
| ~Object () noexcept override
Protected Member Functions inherited from Glib::ObjectBase
| ObjectBase ()
| ObjectBase (const char *custom_type_name)
| ObjectBase (const std::type_info &custom_type_info)
| ObjectBase (ObjectBase &&src) noexcept
ObjectBase & | operator= (ObjectBase &&src) noexcept
virtual | ~ObjectBase () noexcept=0
void | initialize (GObject *castitem)
void | initialize_move (GObject *castitem, Glib::ObjectBase *previous_wrapper)

## Detailed Description

A Gdk::DragContext holds information about a drag in progress.

It is used on both source and destination sides.

## Constructor & Destructor Documentation

## ◆ DragContext()

Gdk::DragContext::DragContext | ( | DragContext&& | src | ) |
| noexcept

## ◆ ~DragContext()

Gdk::DragContext::~DragContext | ( |  | ) |
| override noexcept

## Member Function Documentation

## ◆ drag_finish()

void Gdk::DragContext::drag_finish | ( | bool | success,
|  | bool | del,
|  | guint32 | time
| ) |  |

Informs the drag source that the drop is finished, and that the data of the drag will no longer be required.

Parameters

  success | A flag indicating whether the drop was successful.
  del | A flag indicating whether the source should delete the original data. (This should be true for a move.)
  time | The timestamp from the "drag_data_drop" signal.

## ◆ drag_refuse()

void Gdk::DragContext::drag_refuse | ( | guint32 | time | ) |

Indicate that a drop will not be accepted.

This function may be called by the drag destination in response to gdk_drag_motion() called by the drag source. Alternatively, call drag_status() to indicate which drag action will be accepted.

Parameters

  time | The timestamp for this operation.

## ◆ drag_status()

void Gdk::DragContext::drag_status | ( | DragAction | action,
|  | guint32 | time
| ) |  |

Selects one of the actions offered by the drag source.

This function is called by the drag destination in response to gdk_drag_motion() called by the drag source.

Parameters

  action | The selected action which will be taken when a drop happens, or 0 to indicate that a drop will not be accepted.
  time | The timestamp for this operation.

## ◆ drop_finish()

void Gdk::DragContext::drop_finish | ( | bool | success,
|  | guint32 | time
| ) |  |

Ends the drag operation after a drop.

This function is called by the drag destination.

Parameters

  success | `true` if the data was successfully received.
  time | The timestamp for this operation.

## ◆ drop_reply()

void Gdk::DragContext::drop_reply | ( | bool | accepted,
|  | guint32 | time
| ) |  |

Accepts or rejects a drop.

This function is called by the drag destination in response to a drop initiated by the drag source.

Parameters

  accepted | `true` if the drop is accepted.
  time | The timestamp for this operation.

## ◆ find_window_for_screen()

void Gdk::DragContext::find_window_for_screen | ( | const Glib::RefPtr< Window >& | drag_window,
|  | const Glib::RefPtr< Screen >& | screen,
|  | int | x_root,
|  | int | y_root,
|  | Glib::RefPtr< Window >& | dest_window,
|  | DragProtocol& | protocol
| ) |  | const

Finds the destination window and DND protocol to use at the given pointer position.

This function is called by the drag source to obtain the dest_window and protocol parameters for gdk_drag_motion().

Since gtkmm 2.2:

Parameters

  drag_window | A window which may be at the pointer position, but should be ignored, since it is put up by the drag source as an icon.
  screen | The screen where the destination window is sought.
  x_root | The x position of the pointer in root coordinates.
  y_root | The y position of the pointer in root coordinates.
  dest_window | Location to store the destination window in.
  protocol | Location to store the DND protocol in.

## ◆ get_actions()

DragAction Gdk::DragContext::get_actions | ( |  | ) | const

Determines the bitmask of actions proposed by the source if get_suggested_action() returns Gdk::ACTION_ASK.

Since gtkmm 2.22:

Returns
  The Gdk::DragAction flags.

## ◆ get_dest_window() [1/2]

Glib::RefPtr<Window> Gdk::DragContext::get_dest_window | ( |  | ) |

Returns the destination windw for the DND operation.

Since gtkmm 3.0:

Returns
  A Gdk::Window.

## ◆ get_dest_window() [2/2]

Glib::RefPtr<const Window> Gdk::DragContext::get_dest_window | ( |  | ) | const

Returns the destination windw for the DND operation.

Since gtkmm 3.0:

Returns
  A Gdk::Window.

## ◆ get_device() [1/2]

Glib::RefPtr<Device> Gdk::DragContext::get_device | ( |  | ) |

Returns the Gdk::Device associated to the drag context.

Returns
  The Gdk::Device associated to context.

## ◆ get_device() [2/2]

Glib::RefPtr<const Device> Gdk::DragContext::get_device | ( |  | ) | const

Returns the Gdk::Device associated to the drag context.

Returns
  The Gdk::Device associated to context.

## ◆ get_protocol()

DragProtocol Gdk::DragContext::get_protocol | ( |  | ) | const

Returns the drag protocol thats used by this context.

Since gtkmm 3.0:

Returns
  The drag protocol.

## ◆ get_selected_action()

DragAction Gdk::DragContext::get_selected_action | ( |  | ) | const

Determines the action chosen by the drag destination.

Since gtkmm 2.22:

Returns
  A Gdk::DragAction value.

## ◆ get_selection()

Glib::ustring Gdk::DragContext::get_selection | ( |  | ) | const

Returns the selection atom for the current source window.

Returns
  The selection atom, or Gdk::NONE.

## ◆ get_source_window() [1/2]

Glib::RefPtr<Window> Gdk::DragContext::get_source_window | ( |  | ) |

Returns the Gdk::Window where the DND operation started.

Since gtkmm 2.22:

Returns
  A Gdk::Window.

## ◆ get_source_window() [2/2]

Glib::RefPtr<const Window> Gdk::DragContext::get_source_window | ( |  | ) | const

Returns the Gdk::Window where the DND operation started.

Since gtkmm 2.22:

Returns
  A Gdk::Window.

## ◆ get_suggested_action()

DragAction Gdk::DragContext::get_suggested_action | ( |  | ) | const

Determines the suggested drag action of the context.

Since gtkmm 2.22:

Returns
  A Gdk::DragAction value.

## ◆ get_type()

static GType Gdk::DragContext::get_type | ( |  | ) |
| static

Get the GType for this class, for use with the underlying GObject type system.

## ◆ gobj() [1/2]

GdkDragContext* Gdk::DragContext::gobj | ( |  | ) |
| inline

Provides access to the underlying C GObject.

## ◆ gobj() [2/2]

const GdkDragContext* Gdk::DragContext::gobj | ( |  | ) | const
| inline

Provides access to the underlying C GObject.

## ◆ gobj_copy()

GdkDragContext* Gdk::DragContext::gobj_copy | ( |  | ) |

Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.

## ◆ list_targets()

std::vector<std::string> Gdk::DragContext::list_targets | ( |  | ) | const

Get a list of targets offered by the source.

Returns
  a list of targets offered by the source.

## ◆ operator=()

DragContext& Gdk::DragContext::operator= | ( | DragContext&& | src | ) |
| noexcept

## ◆ set_device()

void Gdk::DragContext::set_device | ( | const Glib::RefPtr< Device >& | device | ) |

Associates a Gdk::Device to context, so all Drag and Drop events for context are emitted as if they came from this device.

Parameters

  device | A Gdk::Device.

## ◆ set_icon() [1/4]

void Gdk::DragContext::set_icon | ( | const ::Cairo::RefPtr< ::Cairo::Surface > & | surface | ) |

## ◆ set_icon() [2/4]

void Gdk::DragContext::set_icon | ( | const Glib::RefPtr< Gdk::Pixbuf >& | pixbuf,
|  | int | hot_x,
|  | int | hot_y
| ) |  |

## ◆ set_icon() [3/4]

void Gdk::DragContext::set_icon | ( | const Glib::ustring & | stock_id,
|  | int | hot_x,
|  | int | hot_y
| ) |  |

## ◆ set_icon() [4/4]

void Gdk::DragContext::set_icon | ( |  | ) |

## ◆ set_icon_name()

void Gdk::DragContext::set_icon_name | ( | const Glib::ustring & | name,
|  | int | hot_x,
|  | int | hot_y
| ) |  |

## Friends And Related Function Documentation

## ◆ wrap()

Glib::RefPtr< Gdk::DragContext > wrap | ( | GdkDragContext * | object,
|  | bool | take_copy = `false`
| ) |  |
| related

A Glib::wrap() method for this object.

Parameters

  object | The C instance.
  take_copy | False if the result should take ownership of the C instance. True if it should take a new copy or ref.

Returns
  A C++ instance that wraps this C instance.