From de34331936777b9e7b520e9e87f1e046a3a45355 Mon Sep 17 00:00:00 2001 From: Mike Kestner Date: Sat, 12 Jul 2003 04:09:00 +0000 Subject: [PATCH] 2003-07-11 Mike Kestner * 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 --- ChangeLog | 9 ++++++++ gdk/Selection.custom | 23 +++++++++++++++++++++ glue/Makefile.am | 1 + glue/selection.c | 48 +++++++++++++++++++++++++++++++++++++++++++ gtk/TextBuffer.custom | 9 ++++++++ 5 files changed, 90 insertions(+) create mode 100644 gdk/Selection.custom create mode 100644 glue/selection.c diff --git a/ChangeLog b/ChangeLog index 60b94a12e..4a3c9c228 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2003-07-11 Mike Kestner + + * 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 * api/*-api.xml : regenerated diff --git a/gdk/Selection.custom b/gdk/Selection.custom new file mode 100644 index 000000000..f894398b2 --- /dev/null +++ b/gdk/Selection.custom @@ -0,0 +1,23 @@ +// Gdk.Selection.custom - Gdk Selection class customizations +// +// Author: Mike Kestner +// +// (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()); + diff --git a/glue/Makefile.am b/glue/Makefile.am index afb310bbc..c88114789 100644 --- a/glue/Makefile.am +++ b/glue/Makefile.am @@ -13,6 +13,7 @@ BASESOURCES = \ list.c \ object.c \ paned.c \ + selection.c \ slist.c \ style.c \ type.c \ diff --git a/glue/selection.c b/glue/selection.c new file mode 100644 index 000000000..4eb1d58e0 --- /dev/null +++ b/glue/selection.c @@ -0,0 +1,48 @@ +/* selection.c : Glue to access GdkAtoms defined in gdkselection.h + * + * Author: Mike Kestner + * + * 2003 Mike Kestner + */ + +#include + +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; +} + + diff --git a/gtk/TextBuffer.custom b/gtk/TextBuffer.custom index 25806d40a..c447f4143 100644 --- a/gtk/TextBuffer.custom +++ b/gtk/TextBuffer.custom @@ -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); +} +