Logo Search packages:      
Sourcecode: ardour version File versions

Gtk::Clipboard Class Reference

#include <clipboard.h>

Inheritance diagram for Gtk::Clipboard:


List of all members.

Detailed Description

The Clipboard object represents a clipboard of data shared between different processes or between different widgets in the same process. Each clipboard is identified by a name encoded as a GdkAtom. * (Conversion to and from strings can be done with gdk_atom_intern() and gdk_atom_name().) The default clipboard corresponds to the "CLIPBOARD" atom; another commonly used clipboard is the "PRIMARY" clipboard, which, in X, traditionally contains the currently selected text.

To support having a number of different formats on the clipboard at the same time, the clipboard mechanism allows providing callbacks instead of the actual data. When you set the contents of the clipboard, you can either supply the data directly (via functions like set_text()), or you can supply a callback to be called at a later time when the data is needed (via set().) Providing a callback also avoids having to make copies of the data when it is not needed.

Requesting the data from the clipboard is essentially asynchronous. If the contents of the clipboard are provided within the same process, then a direct function call will be made to retrieve the data, but if they are provided by another process, then the data needs to be retrieved from the other process, which may take some time. To avoid blocking the user interface, the call to request the selection, request_contents() takes a callback that will be called when the contents are received (or when the request fails.) If you don't want to deal with providing a separate callback, you can also use wait_for_contents(). This runs the GLib main loop recursively waiting for the contents. This can simplify the code flow, but you still have to be aware that other callbacks in your program can be called while this recursive mainloop is running.

Along with the functions to get the clipboard contents as an arbitrary data chunk, there are also functions to retrieve it as text, request_text() and wait_for_text(). These functions take care of determining which formats are advertised by the clipboard provider, asking for the clipboard in the best available format and converting the results into the UTF-8 encoding.

Definition at line 75 of file clipboard.h.

Public Types

typedef GtkClipboardClass BaseClassType
typedef GtkClipboard BaseObjectType
typedef Clipboard_Class CppClassType
typedef Clipboard CppObjectType
typedef void(* DestroyNotify )(gpointer data)
typedef sigc::slot< void > SlotClear
 For instance: void on_clear();.
typedef sigc::slot< void,
SelectionData &, guint > 
 For instance: void on_get(Gtk::SelectionData& selection_data, guint info);.
typedef sigc::slot< void,
const Glib::RefPtr
< Gdk::Pixbuf > & > 
 For instance: void on_image_received(const Glib::RefPtr<Gdk::Pixbuf>& text);.
typedef sigc::slot< void,
const SelectionData & > 
 For instance: void on_received(const SelectionData& selection_data);.
typedef sigc::slot< void,
const Glib::StringArrayHandle & > 
 For instance: void on_targetsreceived(const Glib::StringArrayHandle& targets);.
typedef sigc::slot< void,
const Glib::ustring & > 
 For instance: void on_text_received(const Glib::ustring& text);.

Public Member Functions

bool _cpp_destruction_is_in_progress () const
void clear ()
void * get_data (const QueryQuark &key)
Glib::RefPtr< const Gdk::Displayget_display () const
Glib::RefPtr< Gdk::Displayget_display ()
Glib::RefPtr< const Glib::Object > get_owner () const
Glib::RefPtr< Glib::Object > get_owner ()
template<class PropertyType>
void get_property (const Glib::ustring &property_name, PropertyType &value) const
 You probably want to use a specific property_*() accessor method instead.
void get_property_value (const Glib::ustring &property_name, Glib::ValueBase &value) const
 You probably want to use a specific property_*() accessor method instead.
const GtkClipboard * gobj () const
 Provides access to the underlying C GObject.
GtkClipboard * gobj ()
 Provides access to the underlying C GObject.
GObject * gobj_copy () const
GtkClipboard * gobj_copy ()
 Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
virtual void reference () const
void remove_data (const QueryQuark &quark)
void request_contents (const Glib::ustring &target, const SlotReceived &slot)
void request_image (const SlotImageReceived &slot)
void request_targets (const SlotTargetsReceived &slot)
void request_text (const SlotTextReceived &slot)
bool set (const ArrayHandle_TargetEntry &targets, const SlotGet &slot_get, const SlotClear &slot_clear)
void set_can_store ()
void set_can_store (const ArrayHandle_TargetEntry &targets)
void set_data (const Quark &key, void *data, DestroyNotify notify)
void set_data (const Quark &key, void *data)
void set_image (const Glib::RefPtr< Gdk::Pixbuf > &pixbuf)
template<class PropertyType>
void set_property (const Glib::ustring &property_name, const PropertyType &value)
 You probably want to use a specific property_*() accessor method instead.
void set_property_value (const Glib::ustring &property_name, const Glib::ValueBase &value)
 You probably want to use a specific property_*() accessor method instead.
void set_text (const Glib::ustring &text)
void * steal_data (const QueryQuark &quark)
void store ()
virtual void unreference () const
SelectionData wait_for_contents (const Glib::ustring &target) const
Glib::RefPtr< Gdk::Pixbuf > wait_for_image () const
Glib::StringArrayHandle wait_for_targets () const
Glib::ustring wait_for_text () const
bool wait_is_image_available () const
bool wait_is_target_available (const Glib::ustring &target)
bool wait_is_text_available () const

Static Public Member Functions

static ObjectBase * _get_current_wrapper (GObject *object)
static Glib::RefPtr< Clipboardget (GdkAtom selection=GDK_SELECTION_CLIPBOARD)
static GType get_base_type () G_GNUC_CONST
static Glib::RefPtr< Clipboardget_for_display (const Glib::RefPtr< Gdk::Display > &display, GdkAtom selection=GDK_SELECTION_CLIPBOARD)
static GType get_type () G_GNUC_CONST

Protected Member Functions

void _set_current_wrapper (GObject *object)
 Clipboard (GtkClipboard *castitem)
 Clipboard (const Glib::ConstructParams &construct_params)
virtual void destroy_notify_ ()
void initialize (GObject *castitem)
bool is_anonymous_custom_ () const
bool is_derived_ () const

Static Protected Member Functions

static void destroy_notify_callback_ (void *data)

Protected Attributes

bool cpp_destruction_in_progress_
const char * custom_type_name_
GObject * gobject_

Package Functions

void add_destroy_notify_callback (void *data, func_destroy_notify func) const
void notify_callbacks ()
 Execute and remove all previously installed callbacks.
void remove_destroy_notify_callback (void *data) const

Package Attributes

 __pad0__:func_destroy_notify func_destroy_notify

Private Member Functions

 Clipboard (const Clipboard &)
Clipboardoperator= (const Clipboard &)

Static Private Attributes

static CppClassType clipboard_class_


class Clipboard_Class
class Glib::GSigConnectionNode
class Glib::Object_Class

Related Functions

(Note that these are not member functions.)

Glib::RefPtr< Glib::Object > wrap (GObject *object, bool take_copy=false)
Glib::RefPtr< Gtk::Clipboardwrap (GtkClipboard *object, bool take_copy=false)

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

Generated by  Doxygen 1.6.0   Back to index