Xfce Foundation Classes
Main Page  | IndexNamespace List  |  Alphabetical List  |  Class List  |  File List


Public Member Functions
Xfc::Gtk::DragContext Class Reference

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

#include <xfc/gtk/dnd.hh>

Inheritance diagram for Xfc::Gtk::DragContext:
Xfc::Gdk::DragContext Xfc::G::Object Xfc::G::TypeInstance Xfc::Trackable

List of all members.

Public Member Functions

Constructors


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.

See also: the Drag and Drop and Selection HOWTOs and examples.


Constructor & Destructor Documentation

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

Construct a new DragContext from an existing GdkDragContext.

Parameters:
drag_contextA pointer to a GdkDragContext.
referenceSet 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 Xfc::Gdk::DragContext.


Member Function Documentation

void Xfc::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:
successA flag indicating whether the drop was successful.
delete_dataA flag indicating whether the source should delete the original data (true for a move).
timeThe timestamp from the "drag_data_drop" signal.

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.

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 Xfc::Gtk::DragContext::set_icon_pixbuf ( Gdk::Pixbuf pixbuf,
int  hot_x,
int  hot_y 
)

Sets pixbuf as the icon for a given drag.

Parameters:
pixbufThe image data for the icon.
hot_xThe X offset within pixbuf of the hotspot.
hot_yThe Y offset within pixbuf of the hotspot.
void Xfc::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:
colormapThe colormap of the icon.
pixmapThe image data for the icon.
maskThe transparency mask for the icon.
hot_xThe X offset within pixmap of the hotspot.
hot_yThe 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 Xfc::Gtk::DragContext::set_icon_stock ( const StockId stock_id,
int  hot_x,
int  hot_y 
)

Sets the icon for a given drstock_idag from a stock ID.

Parameters:
stock_idThe identifier of the stock icon to use for the drag.
hot_xThe X offset within icon of the hotspot.
hot_yThe Y offset within icon of the hotspot.
void Xfc::Gtk::DragContext::set_icon_widget ( Widget widget,
int  hot_x,
int  hot_y 
)

Changes the icon for a widget to a given widget.

Parameters:
widgetA toplevel window to use as an icon.
hot_xThe X offset within widget of the hotspot.
hot_yThe 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:
Xfce Foundation Classes
Copyright © 2004-2005 The XFC Development Team XFC