Reference Manual

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

# Inti::Gdk::DragContext Class Reference

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

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

Inheritance diagram for Inti::Gdk::DragContext:

List of all members.

## Public Member Functions

Constructors

- virtual ~DragContext ()
    Destructor.

Accessors

- GdkDragContext * gdk_drag_context () const
    Get a pointer to the GdkDragContext structure.
- GdkDragContextClass * gdk_drag_context_class () const
    Get a pointer to the GdkDragContextClass structure.
- operator GdkDragContext * () const
    Conversion operator; safely converts a DragContext to a GdkDragContext pointer.
- DragProtocol protocol () const
    Returns the DND protocol which governs this drag.
- bool is_source () const
    Returns true if the context is used on the source side.
- Window * source_window () const
    Returns the source window of this drag.
- Window * dest_window () const
    Returns the destination window of this drag.
- bool targets (std::vector< Atom > &target_list) const
    Gets a list of targets offered by the source.
- DragActionField actions () const
    Returns a bitmask of actions proposed by the source when suggested_action is ACTION_ASK.
- DragActionField suggested_action () const
    Returns the action suggested by the source.
- DragActionField action () const
    Returns the action chosen by the destination.
- unsigned int start_time () const
    Returns a timestamp recording the start time of this drag.
- Atom get_selection () const
    Gets the selection atom for the current source window.

Methods

- void drag_status (DragActionField action, unsigned int time)
    Selects one of the actions offered by the drag source.
- void drop_reply (bool ok, unsigned int time)
    Accepts or rejects a drop.
- void drop_finish (bool success, unsigned int time)
    Ends the drag operation after a drop.
- void 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.
- bool 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.
- void drag_drop (unsigned int time)
    Drops on the current destination.
- void drag_abort (unsigned int time)
    Aborts a drag without dropping.

## Static Public Member Functions

- Pointer< DragContext > drag_begin (const Window &window, const std::vector< Atom > &targets)
    Starts a drag and creates a new drag context for it.
- unsigned int drag_get_protocol (unsigned int xid, DragProtocol *protocol, const Display *display=0)
    Finds out the DND protocol supported by a window.

## Protected Member Functions

Constructors

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

## 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

Inti::Gdk::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 in Inti::Gtk::DragContext.

## Member Function Documentation

void Inti::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.

Pointer<DragContext> Inti::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.

void Inti::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.

unsigned int Inti::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.

bool Inti::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 Inti::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 Inti::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 Inti::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 Inti::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().

Atom Inti::Gdk::DragContext::get_selection | ( |  | ) | const

| Gets the selection atom for the current source window. Returns: The selection atom.

bool Inti::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.

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

- gdk/dnd.h

Main Page - Footer