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


Public Member Functions | Static Public Member Functions
Xfc::Gdk::DragContext Class Reference

A GdkDragContext C++ wrapper class. More...

#include <xfc/gdk/dnd.hh>

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

List of all members.

Public Member Functions

Static Public Member Functions

Constructors


Detailed Description

A GdkDragContext C++ wrapper class.

DragContext provides a low level interface for drag and drop. The X backend of GDK supports both the Xdnd and Motif drag and drop protocols transparently, the Win32 backend supports the WM_DROPFILES protocol.

GTK+ provides a higher level abstraction based on top of this inteface, so it's not normally needed in GTK+ applications.


Constructor & Destructor Documentation

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

Construct a new DragContext from an existing GdkDragContext.

Parameters:
drag_contextA pointer to a GdkDragContext.
owns_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 in Xfc::Gtk::DragContext.


Member Function Documentation

void Xfc::Gdk::DragContext::drag_abort ( unsigned int  time)

Aborts a drag without dropping.

Parameters:
timeThe timestamp for this operation.

This method is called by the drag source.

static Pointer<DragContext> Xfc::Gdk::DragContext::drag_begin ( const Window window,
const std::vector< Atom > &  targets 
) [static]

Starts a drag and creates a new drag context for it.

Parameters:
windowThe source window for this drag.
targetsA reference to a vector of Atom holding the list of offered targets.
Returns:
A smart pointer to a newly created DragContext.

This method is called by the drag source.

void Xfc::Gdk::DragContext::drag_drop ( unsigned int  time)

Drops on the current destination.

Parameters:
timeThe timestamp for this operation.

This method is called by the drag source.

Determines wether the dropped data has been successfully transferred.

Returns:
true if the drop was successful.

This method is intended to be used while handling a Gdk::DROP_FINISHED event, its return value is meaningless at other times.

static unsigned int Xfc::Gdk::DragContext::drag_get_protocol ( unsigned int  xid,
DragProtocol protocol,
const Display display = 0 
) [static]

Finds out the DND protocol supported by a window.

Parameters:
xidThe X id of the destination window.
protocolThe location where the supported DND protocol is returned.
displayThe Display where the destination window resides, or null for the defualt display.
Returns:
The X id of the window where the drop should happen.

The X id may be xid or the X id of a proxy window, or none if xid doesn't support Drag and Drop.

bool Xfc::Gdk::DragContext::drag_motion ( const Window dest_window,
DragProtocol  protocol,
int  x_root,
int  y_root,
DragActionField  suggested_action,
DragActionField  possible_actions,
unsigned int  time 
)

Updates the drag context when the pointer moves or the set of actions changes.

Parameters:
dest_windowThe new destination window, obtained by find_window().
protocolThe DND protocol in use, obtained by find_window().
x_rootThe X position of the pointer in root coordinates.
y_rootThe y position of the pointer in root coordinates.
suggested_actionThe suggested action.
possible_actionsThe possible actions.
timeThe timestamp for this operation.
Returns:

This method is called by the drag source.

void Xfc::Gdk::DragContext::drag_status ( DragActionField  action,
unsigned int  time 
)

Selects one of the actions offered by the drag source.

Parameters:
actionThe selected action which will be taken when a drop happens, or 0 to indicate that a drop will not be accepted.
timeThe timestamp for this operation.

This method is called by the drag destination in response to drag_motion() called by the drag source.

void Xfc::Gdk::DragContext::drop_finish ( bool  success,
unsigned int  time 
)

Ends the drag operation after a drop.

Parameters:
successset true if the data was successfully received.
timeThe timestamp for this operation.

This method is called by the drag destination.

void Xfc::Gdk::DragContext::drop_reply ( bool  ok,
unsigned int  time 
)

Accepts or rejects a drop.

Parameters:
okSet true if the drop is accepted.
timeThe timestamp for this operation.

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

void Xfc::Gdk::DragContext::find_window ( int  x_root,
int  y_root,
Window **  dest_window,
DragProtocol protocol,
const Screen screen = 0 
)

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

Parameters:
x_rootThe X position of the pointer in root coordinates.
y_rootThe Y position of the pointer in root coordinates.
dest_windowThe location to store the destination window in.
protocolThe location to store the DND protocol in.
screenThe screen where the destination window is sought, or null for the screen the source window is on.

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

Gets the selection atom for the current source window.

Returns:
The selection atom.

Set the drag action value that specifies what destination should do with the dropped data.

Parameters:
actionThe new Gdk::DragAction value to set.

You would typically call this method from within a Gtk::Widget drag_data_received signal handler. By calling action(), you can inspect the drag action chosen by the drop site and modify its value.

bool Xfc::Gdk::DragContext::targets ( std::vector< Atom > &  target_list) const

Gets a list of targets offered by the source.

Parameters:
target_listA reference to a vector of Atom to hold the list of targets.
Returns:
true if the vector is not empty.

The documentation for this class was generated from the following file:
Xfce Foundation Classes
Copyright © 2004-2005 The XFC Development Team XFC