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


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

Accessors
Methods

Static Public Member Functions

Accessors
Methods

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

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

Construct a new DragContext from an existing GdkDragContext.

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


Member Function Documentation

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

Gets a list of targets offered by the source.

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

Atom Xfc::Gdk::DragContext::get_selection (  )  const

Gets the selection atom for the current source window.

Returns:
The selection atom.

bool Xfc::Gdk::DragContext::drag_drop_succeeded (  )  const

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:
xid The X id of the destination window.
protocol The location where the supported DND protocol is returned.
display The 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.

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

Selects one of the actions offered 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.
This method is called by the drag destination in response to drag_motion() called by the drag source.

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

Accepts or rejects a drop.

Parameters:
ok Set true if the drop is accepted.
time The 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::drop_finish ( bool  success,
unsigned int  time 
)

Ends the drag operation after a drop.

Parameters:
success set true if the data was successfully received.
time The timestamp for this operation.
This method is called by the drag destination.

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_root The X position of the pointer in root coordinates.
y_root The Y position of the pointer in root coordinates.
dest_window The location to store the destination window in.
protocol The location to store the DND protocol in.
screen The 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().

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_window The new destination window, obtained by find_window().
protocol The DND protocol in use, obtained by find_window().
x_root The X position of the pointer in root coordinates.
y_root The y position of the pointer in root coordinates.
suggested_action The suggested action.
possible_actions The possible actions.
time The timestamp for this operation.
Returns:
This method is called by the drag source.

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

Drops on the current destination.

Parameters:
time The timestamp for this operation.
This method is called by the drag source.

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

Aborts a drag without dropping.

Parameters:
time The timestamp for this operation.
This method is called by the drag source.

void Xfc::Gdk::DragContext::set_action ( DragActionField  action  ) 

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

Parameters:
action The 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.

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:
window The source window for this drag.
targets A 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.


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