eb05362005-11-05Henrik Grubbström (Grubba) /* -*- C -*- */
1a05542005-07-28Martin Nilsson require gtk22; class GTK2.Clipboard; inherit G.Object; //! Clipboard implementation. /* void create() //! Constructor. {
ba9e802006-02-27Martin Stjernholm  pgtk2_verify_setup(); pgtk2_verify_not_inited();
1a05542005-07-28Martin Nilsson  THIS->obj=g_malloc(sizeof(GtkClipboard)); if (THIS->obj==NULL) SIMPLE_OUT_OF_MEMORY_ERROR("create",sizeof(GtkClipboard));
ba9e802006-02-27Martin Stjernholm  pgtk2_pop_n_elems(args); pgtk2__init_this_object();
1a05542005-07-28Martin Nilsson } */
2edd4f2008-01-30Per Hedbor 
15ab0b2017-11-05Henrik Grubbström (Grubba) void _destruct()
1a05542005-07-28Martin Nilsson {
2edd4f2008-01-30Per Hedbor  /* 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. */
1a05542005-07-28Martin Nilsson  THIS->obj=0; } GTK2.Clipboard get(GDK2.Atom selection) //! Returns the clipboard object for the given selection. {
ba9e802006-02-27Martin Stjernholm  pgtk2_verify_inited();
1a05542005-07-28Martin Nilsson  { struct object *o1;
96f5f42018-08-05Martin Nilsson  get_all_args(NULL,args,"%o",&o1);
1a05542005-07-28Martin Nilsson  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. {
ba9e802006-02-27Martin Stjernholm  pgtk2_verify_inited();
1a05542005-07-28Martin Nilsson  { struct object *o1,*o2;
96f5f42018-08-05Martin Nilsson  get_all_args(NULL,args,"%o",&o1,&o2);
1a05542005-07-28Martin Nilsson  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.
a7f5322011-01-15Henrik Grubbström (Grubba) void set_text(sprintf_format text, sprintf_args ... fmt)
a91e462010-09-19Marcus Comstedt //! Sets the contents of the clipboard to the given string.
208e092010-09-19Marcus Comstedt //! If multiple arguments are supplied, sprintf() is called implicitly. { pgtk2_get_string_arg_with_sprintf(args); pgtk2_verify_inited(); gtk_clipboard_set_text( GTK_CLIPBOARD(THIS->obj),Pike_sp[-1].u.string->str,Pike_sp[-1].u.string->len); pgtk2_return_this(1); }
1a05542005-07-28Martin Nilsson  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();
a91e462010-09-19Marcus Comstedt //! Requests the contents of the clipboard as text
1a05542005-07-28Martin Nilsson  require gtk26; GDK2.Pixbuf wait_for_image(); //! Requests the contents of the clipboard as image and converts the result //! to a GDK2.Pixbuf. endrequire;
f284492006-08-03Lance Dillon 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;
96f5f42018-08-05Martin Nilsson  get_all_args(NULL,args,"%o",&o1);
f284492006-08-03Lance Dillon  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;
1a05542005-07-28Martin Nilsson 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;
f284492006-08-03Lance Dillon require gtk210; int wait_is_rich_text_available(GTK2.TextBuffer buffer); //! Test to see if there is rich text available to be pasted. endrequire;
1a05542005-07-28Martin Nilsson endrequire;