Reference Manual

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members

# Inti::Gtk::DragContext Class Reference

A GTK+ Drag and Drop C++ wrapper class. More...

`#include <inti/gtk/dnd.h>`

Inheritance diagram for Inti::Gtk::DragContext:

List of all members.

## Public Member Functions

Constructors

- virtual ~DragContext ()
    Destructor.

Accessors

- Widget * get_source_widget () const
    Determines the source widget for a drag.

Methods

- void finish (bool success, bool delete_data, unsigned int time)
    Informs the drag source that the drop is finished, and that the data of the drag will no longer be required.
- void set_icon_widget (Widget &widget, int hot_x, int hot_y)
    Changes the icon for a widget to a given widget.
- void set_icon_pixmap (Gdk::Colormap &colormap, Gdk::Pixmap &pixmap, Gdk::Bitmap *mask, int hot_x, int hot_y)
    Sets pixmap as the icon for a given drag.
- void set_icon_pixbuf (Gdk::Pixbuf &pixbuf, int hot_x, int hot_y)
    Sets pixbuf as the icon for a given drag.
- void set_icon_stock (const char *stock_id, int hot_x, int hot_y)
    Sets the the icon for a given drag from a stock ID.
- void set_icon_default ()
    Sets the icon for a particular drag to the default icon.

## Protected Member Functions

Constructors

- DragContext (GdkDragContext *drag_context, bool reference=true)
    Construct a new DragContext from an existing GdkDragContext.

## Detailed Description

A GTK+ Drag and Drop C++ wrapper class.

GTK+ has a rich set of functions for doing inter-process communication via the drag-and-drop metaphor. GTK+ can do drag-and-drop (DND) via multiple protocols. The currently supported protocols are the Xdnd and Motif protocols. As well as the methods in this class, applications may need to use some facilities provided for Selections. Also, the Drag and Drop API makes use of signals in the Widget class.

DragContext is a convenient wrapper class for the GTK+ drag-and-drop functions. It derives from Gdk::DragContext. There is no GtkDragContext.

The default icon for a drag opration can be changed via the stock system by changing the stock pixbuf for GTK_STOCK_DND.

## Constructor & Destructor Documentation

Inti::Gtk::DragContext::DragContext | ( | GdkDragContext * | drag_context,
|  | bool | reference = true
| ) | `[explicit, protected]`

  | Construct a new DragContext from an existing GdkDragContext. Parameters:
  drag_context | A pointer to a GdkDragContext.
  reference | Set false if the initial reference count is floating, set true if it's not.
The drag_context can be a newly created GdkDragContext or an existing GdkDragContext. (see G::Object::Object). Reimplemented from Inti::Gdk::DragContext.

## Member Function Documentation

void Inti::Gtk::DragContext::finish | ( | bool | success,
|  | bool | delete_data,
|  | unsigned int | 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.
  delete_data | A flag indicating whether the source should delete the original data (true for a move).
  time | The timestamp from the "drag_data_drop" signal.

Widget* Inti::Gtk::DragContext::get_source_widget | ( |  | ) | const

| Determines the source widget for a drag. Returns: If the drag is occurring within a single application, a pointer to the source widget. Otherwise, null.

void Inti::Gtk::DragContext::set_icon_default | ( |  | ) |

| Sets the icon for a particular drag to the default icon. This must be called with a context for the source side of a drag.

void Inti::Gtk::DragContext::set_icon_pixbuf | ( | Gdk::Pixbuf & | pixbuf,
|  | int | hot_x,
|  | int | hot_y
| ) |

  | Sets pixbuf as the icon for a given drag. Parameters:
  pixbuf | The image data for the icon.
  hot_x | The X offset within pixbuf of the hotspot.
  hot_y | The Y offset within pixbuf of the hotspot.

void Inti::Gtk::DragContext::set_icon_pixmap | ( | Gdk::Colormap & | colormap,
|  | Gdk::Pixmap & | pixmap,
|  | Gdk::Bitmap * | mask,
|  | int | hot_x,
|  | int | hot_y
| ) |

  | Sets pixmap as the icon for a given drag. Parameters:
  colormap | The colormap of the icon.
  pixmap | The image data for the icon.
  mask | The transparency mask for the icon.
  hot_x | The X offset within pixmap of the hotspot.
  hot_y | The Y offset within pixmap of the hotspot.
GTK+ retains references for the arguments, and will release them when they are no longer needed. In general, set_icon_pixbuf() will be more convenient to use.

void Inti::Gtk::DragContext::set_icon_stock | ( | const char * | stock_id,
|  | int | hot_x,
|  | int | hot_y
| ) |

  | Sets the the icon for a given drag from a stock ID. Parameters:
  stock_id | The ID of the stock icon to use for the drag.
  hot_x | The X offset within icon of the hotspot.
  hot_y | The Y offset within icon of the hotspot.

void Inti::Gtk::DragContext::set_icon_widget | ( | Widget & | widget,
|  | int | hot_x,
|  | int | hot_y
| ) |

  | Changes the icon for a widget to a given widget. Parameters:
  widget | A toplevel window 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.
GTK+ will not destroy the icon, so if you don't want it to persist, you should connect to the "drag_end" signal and destroy it yourself.

The documentation for this class was generated from the following file:

- gtk/dnd.h

Main Page - Footer