From 9f3cd6ae80252e383b2862979d9dc65b50c5c094 Mon Sep 17 00:00:00 2001 From: Mike Kestner Date: Fri, 26 Dec 2003 15:14:07 +0000 Subject: [PATCH] 2003-12-26 Mike Kestner * glue/selectiondata.c : new glue to make SelectionData opaque * glue/Makefile.am : add file * glue/makefile.win32 : add file * gtk/Gtk.metadata : mark SelectionData opaque, unhide Set method * gtk/SelectionData.custom : invoke glue methods for opaque fields. * gtk/gtk-api.xml : regen * sample/TestDnd.cs : update to new SelectionData API. svn path=/trunk/gtk-sharp/; revision=21502 --- ChangeLog | 10 ++++++++++ glue/Makefile.am | 1 + glue/makefile.win32 | 1 + glue/selectiondata.c | 25 +++++++++++++++++++++++++ gtk/Gtk.metadata | 2 +- gtk/SelectionData.custom | 38 +++++++++++++++++++++----------------- gtk/gtk-api.xml | 4 ++-- sample/TestDnd.cs | 4 ++-- 8 files changed, 63 insertions(+), 22 deletions(-) create mode 100644 glue/selectiondata.c diff --git a/ChangeLog b/ChangeLog index 516128a17..af43097bc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2003-12-26 Mike Kestner + + * glue/selectiondata.c : new glue to make SelectionData opaque + * glue/Makefile.am : add file + * glue/makefile.win32 : add file + * gtk/Gtk.metadata : mark SelectionData opaque, unhide Set method + * gtk/SelectionData.custom : invoke glue methods for opaque fields. + * gtk/gtk-api.xml : regen + * sample/TestDnd.cs : update to new SelectionData API. + 2003-12-21 John Luke * glib/Idle.cs: add Remove method found in Alp Toker's platano diff --git a/glue/Makefile.am b/glue/Makefile.am index 61f58b964..8283201f2 100644 --- a/glue/Makefile.am +++ b/glue/Makefile.am @@ -17,6 +17,7 @@ BASESOURCES = \ object.c \ paned.c \ selection.c \ + selectiondata.c \ slist.c \ style.c \ type.c \ diff --git a/glue/makefile.win32 b/glue/makefile.win32 index 71062dc9e..ad6ae02d1 100755 --- a/glue/makefile.win32 +++ b/glue/makefile.win32 @@ -19,6 +19,7 @@ GLUE_OBJS = \ object.o \ paned.o \ selection.o \ + selectiondata.o \ slist.o \ style.o \ type.o \ diff --git a/glue/selectiondata.c b/glue/selectiondata.c new file mode 100644 index 000000000..e0d9210e3 --- /dev/null +++ b/glue/selectiondata.c @@ -0,0 +1,25 @@ +/* selectiondata.c : Glue to access fields of GtkSelectionData + * + * Author: Mike Kestner + * + * 2003 Novell, Inc. + */ + +#include +#include + +gint gtksharp_gtk_selection_data_get_length (GtkSelectionData *data); +gint gtksharp_gtk_selection_data_get_format (GtkSelectionData *data); + +gint +gtksharp_gtk_selection_data_get_length (GtkSelectionData *data) +{ + return data->length; +} + +gint +gtksharp_gtk_selection_data_get_format (GtkSelectionData *data) +{ + return data->format; +} + diff --git a/gtk/Gtk.metadata b/gtk/Gtk.metadata index ddf4395f5..9686b8929 100644 --- a/gtk/Gtk.metadata +++ b/gtk/Gtk.metadata @@ -2,8 +2,8 @@ 1 1 + 1 1 - 1 1 out 1 diff --git a/gtk/SelectionData.custom b/gtk/SelectionData.custom index ad25ab27f..e7fdc9982 100644 --- a/gtk/SelectionData.custom +++ b/gtk/SelectionData.custom @@ -1,29 +1,33 @@ + [DllImport("gtksharpglue")] + private static extern int gtksharp_gtk_selection_data_get_format (IntPtr selection_data); + + public int Format { + get { + return gtksharp_gtk_selection_data_get_format (Handle); + } + } + + [DllImport("gtksharpglue")] + private static extern int gtksharp_gtk_selection_data_get_length (IntPtr selection_data); + + public int Length { + get { + return gtksharp_gtk_selection_data_get_length (Handle); + } + } [DllImport("libgtk-win32-2.0-0.dll")] - private static extern IntPtr gtk_selection_data_get_text (ref Gtk.SelectionData selection_data); + private static extern IntPtr gtk_selection_data_get_text (IntPtr selection_data); [DllImport("libgtk-win32-2.0-0.dll")] - private static extern void gtk_selection_data_set_text (ref Gtk.SelectionData selection_data, string str, int len); + private static extern void gtk_selection_data_set_text (IntPtr selection_data, string str, int len); public string Text { get { - return GLibSharp.Marshaller.PtrToStringGFree (gtk_selection_data_get_text (ref this)); + return GLibSharp.Marshaller.PtrToStringGFree (gtk_selection_data_get_text (Handle)); } set { - gtk_selection_data_set_text (ref this, value, value.Length); + gtk_selection_data_set_text (Handle, value, value.Length); } } - [DllImport("libgtk-win32-2.0-0.dll")] - static extern void gtk_selection_data_set (ref Gtk.SelectionData raw, IntPtr type, int format, byte[] data, int length); - - public byte[] Data { - get { - byte[] ret = new byte[length]; - Marshal.Copy (_data, ret, 0, length); - return ret; - } - set { - gtk_selection_data_set (ref this, _type, format, value, value.Length); - } - } diff --git a/gtk/gtk-api.xml b/gtk/gtk-api.xml index f5dbb0ba4..40cacdc4b 100644 --- a/gtk/gtk-api.xml +++ b/gtk/gtk-api.xml @@ -11428,7 +11428,7 @@ - + @@ -11455,7 +11455,7 @@ -