ROX-CLib: rox_dnd.h File Reference

- Main Page
- Data Structures
- Files
- Related Pages

- File List
- Globals

# rox_dnd.h File Reference

Utilities for using drag & drop with ROX apps. More...

## Defines
#define | rox_dnd_register_uris(w, f, u, d) rox_dnd_register_full(w, f, u, NULL, d)
#define | rox_dnd_register_xds(w, f, x, d) rox_dnd_register_full(w, f, NULL, x, d)
## Typedefs
typedef gboolean(*) | rox_dnd_handle_uris (GtkWidget *widget, GSList *uris, gpointer data, gpointer udata)
typedef gboolean(*) | rox_dnd_handle_xds (GtkWidget *widget, const gchar *path, gpointer data, gpointer udata)
## Functions
void | rox_dnd_init (void)
void | rox_dnd_register_full (GtkWidget *widget, guint flags, rox_dnd_handle_uris, rox_dnd_handle_xds, gpointer udata)
GSList * | rox_dnd_filter_local (GSList *uris)
void | rox_dnd_local_free (GSList *paths)

## Detailed Description

Utilities for using drag & drop with ROX apps.

Author:
  Stephen Watson

Version:
  Id
    rox_dnd.h,v 1.4 2005/09/10 16:15:58 stephen Exp

## Define Documentation

#define rox_dnd_register_uris | ( | w,
|  | f,
|  | u,
|  | d |  | ) | rox_dnd_register_full(w, f, u, NULL, d)

Register a handler for a widget that handles URIs only.

Parameters:

  `[in]` | w | widget
  `[in]` | f | flags
  `[in]` | u | callback function
  `[in]` | d | additional data to pass

#define rox_dnd_register_xds | ( | w,
|  | f,
|  | x,
|  | d |  | ) | rox_dnd_register_full(w, f, NULL, x, d)

Register a handler for a widget that handles URIs only.

Parameters:

  `[in]` | w | widget
  `[in]` | f | flags
  `[in]` | x | callback function
  `[in]` | d | additional data to pass

## Typedef Documentation

typedef gboolean(*) rox_dnd_handle_uris(GtkWidget *widget, GSList *uris, gpointer data, gpointer udata)

Function which responds to drop on a widget by processing a list of URIs.

Parameters:

  `[in]` | widget | the widget that was the target of the drop
  `[in]` | uris | list of URIs to process
  `[in]` | data | internal data, ignore.
  `[in]` | udata | user data passed when the callback was registered in rox_dnd_register_full()

Returns:
  `TRUE` if handled successfully, `FALSE` otherwise.

typedef gboolean(*) rox_dnd_handle_xds(GtkWidget *widget, const gchar *path, gpointer data, gpointer udata)

Function which responds to drop on a widget by the XDS protocol. The system negotiates a temporary file to store the transfered file.

Parameters:

  `[in]` | widget | the widget that was the target of the drop
  `[in]` | path | path to the file the dropped data was stored in. Delete this file when it is finished with.
  `[in]` | data | internal data, ignore.
  `[in]` | udata | user data passed when the callback was registered in rox_dnd_register_full()

Returns:
  `TRUE` if handled successfully, `FALSE` otherwise.

## Function Documentation

GSList* rox_dnd_filter_local | ( | GSList * | uris | ) |

Given a list of URIs return only those which are local files. Uses rox_path_get_local().

Parameters:

  `[in]` | uris | list of URIs.

Returns:
  list of local paths (pass to rox_dnd_local_free() when done, or `NULL` if none of the URIs were local files.

void rox_dnd_init | ( | void |  | ) |

Initialize the drag and drop system. Calling this function is optional, the other dnd functions will call this automatically if they detect that initialization has not been performed.

void rox_dnd_local_free | ( | GSList * | paths | ) |

Free a list of local files returned by rox_dnd_filter_local().

Parameters:

  `[in,out]` | paths | list of local files returned by rox_dnd_filter_local().

void rox_dnd_register_full | ( | GtkWidget * | widget,
|  | guint | flags,
|  | rox_dnd_handle_uris | uris,
|  | rox_dnd_handle_xds | xds,
|  | gpointer | udata |
| ) |  |  |

Register callback functions for handling drag and drop on a widget.

Parameters:

  `[in]` | widget | widget which will accept drops.
  `[in]` | flags | bit mask of flags. None are currently defined.
  `[in]` | uris | function to call to handle the text/uri-list protocol.
  `[in]` | xds | function to call to handle the X Direct Save protocol.
  `[in]` | udata | additional user data to pass to callback functions.