2003-07-11 Mike Kestner <mkestner@speakeasy.net>

* gdk/Selection.custom : add static fields for the  primary,
	secondary, and clipboard and clipboard selection Gdk.Atoms.
	* glue/Makefile.am : add selection.c
	* glue/selection.c : add glue to get the atoms.
	* gtk/TextBuffer.custom : add a PasteClipboard overload for
	pasting to the cursor location.

svn path=/trunk/gtk-sharp/; revision=16130
This commit is contained in:
Mike Kestner 2003-07-12 04:09:00 +00:00
parent 3ff827ed69
commit de34331936
5 changed files with 90 additions and 0 deletions

View file

@ -1,3 +1,12 @@
2003-07-11 Mike Kestner <mkestner@speakeasy.net>
* gdk/Selection.custom : add static fields for the primary,
secondary, and clipboard and clipboard selection Gdk.Atoms.
* glue/Makefile.am : add selection.c
* glue/selection.c : add glue to get the atoms.
* gtk/TextBuffer.custom : add a PasteClipboard overload for
pasting to the cursor location.
2003-07-10 Mike Kestner <mkestner@speakeasy.net>
* api/*-api.xml : regenerated

23
gdk/Selection.custom Normal file
View file

@ -0,0 +1,23 @@
// Gdk.Selection.custom - Gdk Selection class customizations
//
// Author: Mike Kestner <mkestner@speakeasy.net>
//
// (c) 2003 Mike Kestner
//
// This code is inserted after the automatically generated code.
[DllImport("gtksharpglue")]
static extern IntPtr gtksharp_get_gdk_selection_primary ();
public static Gdk.Atom Primary = new Gdk.Atom (gtksharp_get_gdk_selection_primary());
[DllImport("gtksharpglue")]
static extern IntPtr gtksharp_get_gdk_selection_secondary ();
public static Gdk.Atom Secondary = new Gdk.Atom (gtksharp_get_gdk_selection_secondary());
[DllImport("gtksharpglue")]
static extern IntPtr gtksharp_get_gdk_selection_clipboard ();
public static Gdk.Atom Clipboard = new Gdk.Atom (gtksharp_get_gdk_selection_clipboard());

View file

@ -13,6 +13,7 @@ BASESOURCES = \
list.c \
object.c \
paned.c \
selection.c \
slist.c \
style.c \
type.c \

48
glue/selection.c Normal file
View file

@ -0,0 +1,48 @@
/* selection.c : Glue to access GdkAtoms defined in gdkselection.h
*
* Author: Mike Kestner <mkestner@speakeasy.net>
*
* <c> 2003 Mike Kestner
*/
#include <gdk/gdkselection.h>
GdkAtom gtksharp_get_gdk_selection_primary (void);
GdkAtom gtksharp_get_gdk_selection_secondary (void);
GdkAtom gtksharp_get_gdk_selection_clipboard (void);
/* FIXME: These are still left to do
#define GDK_TARGET_BITMAP
#define GDK_TARGET_COLORMAP
#define GDK_TARGET_DRAWABLE
#define GDK_TARGET_PIXMAP
#define GDK_TARGET_STRING
#define GDK_SELECTION_TYPE_ATOM
#define GDK_SELECTION_TYPE_BITMAP
#define GDK_SELECTION_TYPE_COLORMAP
#define GDK_SELECTION_TYPE_DRAWABLE
#define GDK_SELECTION_TYPE_INTEGER
#define GDK_SELECTION_TYPE_PIXMAP
#define GDK_SELECTION_TYPE_WINDOW
#define GDK_SELECTION_TYPE_STRING
*/
GdkAtom
gtksharp_get_gdk_selection_primary ()
{
return GDK_SELECTION_PRIMARY;
}
GdkAtom
gtksharp_get_gdk_selection_secondary ()
{
return GDK_SELECTION_SECONDARY;
}
GdkAtom
gtksharp_get_gdk_selection_clipboard ()
{
return GDK_SELECTION_CLIPBOARD;
}

View file

@ -22,3 +22,12 @@ public Gtk.TextIter GetIterAtOffset(int char_offset)
return iter;
}
// overload to paste clipboard contents at cursor editable by default.
[DllImport("libgtk-win32-2.0-0.dll")]
static extern void gtk_text_buffer_paste_clipboard (IntPtr raw, IntPtr clip, IntPtr iter, bool default_edit);
public void PasteClipboard (Gtk.Clipboard clipboard)
{
gtk_text_buffer_paste_clipboard(Handle, clipboard.Handle, IntPtr.Zero, true);
}