Xfce Foundation Classes
Main Page | Index | Namespace List | Alphabetical List | Class List | File List

# Xfc::Gtk::TargetList Class Reference

A GtkTargetList C++ wrapper class. More...

`#include <xfc/gtk/selection.hh>`

Inheritance diagram for Xfc::Gtk::TargetList:

List of all members.

## Public Member Functions

Constructors

- TargetList ()
    Construct an empty target list with a reference count of 1 that the caller owns.
- TargetList (const std::vector< TargetEntry > &targets)
    Construct a target list that contains the target entries in targets.
- TargetList (GtkTargetList *target_list)
    Constructs a new TargetList from an existing GtkTargetList.
- virtual ~TargetList ()
    Destructor.

Accessors

- GtkTargetList * gtk_target_list () const
    Get a pointer to the GtkTargetList structure.
- operator GtkTargetList * () const
    Conversion operator; safely converts a TargetList to a GtkTargetList pointer.

Methods

- void add (Gdk::Atom target, unsigned int flags, unsigned int info)
    Adds a target to the TargetList.
- void add (const TargetEntry &entry)
    Adds a TargetEntry to the target list.
- void add (const std::vector< TargetEntry > &targets)
    Adds a vector of TargetEntry to the target list.
- void add_text_targets (unsigned int info)
    Adds the text targets supported by GTK+ selection to the target list.
- void add_image_targets (unsigned int info, bool writable)
    Adds the image targets supported by GTK+ selection to the target list.
- void add_uri_targets (unsigned int info)
    Adds the URI targets supported by GTK+ selection to the target list.
- void remove (Gdk::Atom target)
    Removes a target from a target list.
- bool find (Gdk::Atom target, unsigned int *info)
    Looks up a given target in the target list.

## Detailed Description

A GtkTargetList C++ wrapper class.

The selection mechanism provides the basis for different types of communication between processes. In particular, drag-and-drop and Clipboard work via selections. You will very seldom or never need to use most of the functions in this section directly; Clipboard provides a nicer interface to the same functionality. Some of the datatypes defined this section are used in the Clipboard and drag-and-drop API's as well.

The TargetList structure represents a list of data types that are supported when sending or receiving data. TargetList is only useful when you want to manually initiate drag and drop to have dynamic control.

Note: dynamically allocated objects must either be unreferenced or assigned to a smart pointer. Stack objects are automatically unreferenced when they go out of scope.

See also: the Selection HOWTO and example.

## Constructor & Destructor Documentation

Xfc::Gtk::TargetList::TargetList | ( | const std::vector< TargetEntry > & | targets | ) |

Construct a target list that contains the target entries in targets.

Parameters:

  | targets | The vector of TargetEntry to add into the target list.

The TargetList is created with a reference count of 1 that the caller owns.

Xfc::Gtk::TargetList::TargetList | ( | GtkTargetList * | target_list | ) |

Constructs a new TargetList from an existing GtkTargetList.

Parameters:

  | target_list | A newly created GtkTargetList with a reference count of 1.

TargetList takes over the ownership of the GtkTargetList reference count, unreferencing the GtkTargetList when it is destroyed.

## Member Function Documentation

void Xfc::Gtk::TargetList::add | ( | const std::vector< TargetEntry > & | targets | ) |

Adds a vector of TargetEntry to the target list.

Parameters:

  | targets | The vector of TargetEntry to add.

void Xfc::Gtk::TargetList::add | ( | const TargetEntry & | entry | ) |

Adds a TargetEntry to the target list.

Parameters:

  | entry | The TargetEntry to add.

void Xfc::Gtk::TargetList::add | ( | Gdk::Atom | target,
|  | unsigned int | flags,
|  | unsigned int | info
| ) |

Adds a target to the TargetList.

Parameters:

  | target | The interned atom representing the target.
  | flags | The flags for this target.
  | info | An ID that will be passed back to the application.

void Xfc::Gtk::TargetList::add_image_targets | ( | unsigned int | info,
|  | bool | writable
| ) |

Adds the image targets supported by GTK+ selection to the target list.

Parameters:

  | info | An ID that will be passed back to the application.
  | writable | Whether to add only targets for which GTK+ knows how to convert a pixbuf into the format.

All targets are added with the same info.

void Xfc::Gtk::TargetList::add_text_targets | ( | unsigned int | info | ) |

Adds the text targets supported by GTK+ selection to the target list.

Parameters:

  | info | An ID that will be passed back to the application.

All targets are added with the same info.

void Xfc::Gtk::TargetList::add_uri_targets | ( | unsigned int | info | ) |

Adds the URI targets supported by GTK+ selection to the target list.

Parameters:

  | info | An ID that will be passed back to the application.

All targets are added with the same info.

bool Xfc::Gtk::TargetList::find | ( | Gdk::Atom | target,
|  | unsigned int * | info
| ) |

Looks up a given target in the target list.

Parameters:

  | target | An interned atom representing the target to search for.
  | info | A pointer to the location to store application info for target.

Returns:
  true if the target was found, otherwise false.

void Xfc::Gtk::TargetList::remove | ( | Gdk::Atom | target | ) |

Removes a target from a target list.

Parameters:

  | target | The interned atom representing the target.

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

- gtk/selection.hh

Xfce Foundation Classes

Copyright © 2004-2005 The XFC Development Team | XFC 4.3