/* -*- C -*- */ |
require gtk22; |
|
class GTK2.Clipboard; |
inherit G.Object; |
|
//! Clipboard implementation. |
|
/* |
void create() |
//! Constructor. |
{ |
pgtk2_verify_setup(); |
pgtk2_verify_not_inited(); |
THIS->obj=g_malloc(sizeof(GtkClipboard)); |
if (THIS->obj==NULL) |
SIMPLE_OUT_OF_MEMORY_ERROR("create",sizeof(GtkClipboard)); |
pgtk2_pop_n_elems(args); |
pgtk2__init_this_object(); |
} |
*/ |
|
|
void destroy() |
{ |
/* From API doc: |
|
Once a clipboard object has been created, it is |
persistent and, since it is owned by GTK+, must not be freed or |
unrefd. |
*/ |
THIS->obj=0; |
} |
|
GTK2.Clipboard get(GDK2.Atom selection) |
//! Returns the clipboard object for the given selection. |
{ |
pgtk2_verify_inited(); |
{ |
struct object *o1; |
get_all_args("get",args,"%o",&o1); |
THIS->obj=G_OBJECT(gtk_clipboard_get(get_gdkatom(o1))); |
} |
RETURN_THIS(); |
} |
|
require gtk22; |
GTK2.Clipboard get_for_display(GDK2.Display display, GDK2.Atom selection) |
//! Returns the clipboard object for the given selection. |
{ |
pgtk2_verify_inited(); |
{ |
struct object *o1,*o2; |
get_all_args("get_for_display",args,"%o",&o1,&o2); |
THIS->obj=G_OBJECT(gtk_clipboard_get_for_display( |
(GdkDisplay *)get_gdkobject(o1,display),get_gdkatom(o2))); |
} |
RETURN_THIS(); |
} |
|
GDK2.Display get_display(); |
//! Gets the GDK2.Display associated with this clipboard. |
endrequire; |
|
void clear(); |
//! Clears the contents of the clipboard. |
|
void set_text(string text, int len); |
//! Sets the contents of the clipboard to the given string. |
|
require gtk26; |
void set_image(GDK2.Pixbuf pixbuf); |
//! Sets the contents of the clipboard to the given GDK2(Pixbuf). |
endrequire; |
|
/* |
// TODO |
string request_text(); |
//! Requests the contents of the clipboard. |
*/ |
|
/* TODO |
require gtk26; |
string request_image(); |
//! Requests the contents of the clipboard as image. |
endrequire; |
*/ |
|
string wait_for_text(); |
//! Requests the contents of the clipboard as text |
|
require gtk26; |
GDK2.Pixbuf wait_for_image(); |
//! Requests the contents of the clipboard as image and converts the result |
//! to a GDK2.Pixbuf. |
endrequire; |
|
require gtk210; |
string wait_for_rich_text(GTK2.TextBuffer buffer) |
//! Requests the contents of the clipboard as rich text. |
{ |
pgtk2_verify_inited(); |
{ |
struct object *o1; |
GtkTextBuffer *gtb; |
GdkAtom a; |
gsize len; |
guint8 *res; |
|
get_all_args("wait_for_rich_text",args,"%o",&o1); |
res=gtk_clipboard_wait_for_rich_text(GTK_CLIPBOARD(THIS->obj), |
GTK_TEXT_BUFFER(get_gobject(o1)),&a,&len); |
pgtk2_pop_n_elems(args); |
if (res) |
push_string(make_shared_binary_string(res,len)); |
else |
push_string(empty_pike_string); |
} |
} |
endrequire; |
|
int wait_is_text_available(); |
//! Test to see if there is text available to be pasted. This is done by |
//! requesting the TARGETS atom and checking if it contains any of the |
//! supported text targets. |
|
require gtk26; |
int wait_is_image_available(); |
//! Test to see if tehre is an image available to be pasted. |
endrequire; |
|
require gtk210; |
int wait_is_rich_text_available(GTK2.TextBuffer buffer); |
//! Test to see if there is rich text available to be pasted. |
endrequire; |
|
endrequire; |
|