2003-12-26 Mike Kestner <mkestner@ximian.com>

* 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
This commit is contained in:
Mike Kestner 2003-12-26 15:14:07 +00:00
parent 7e9700901f
commit 9f3cd6ae80
8 changed files with 63 additions and 22 deletions

View file

@ -1,3 +1,13 @@
2003-12-26 Mike Kestner <mkestner@ximian.com>
* 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 <jluke@cfl.rr.com>
* glib/Idle.cs: add Remove method found in Alp Toker's platano

View file

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

View file

@ -19,6 +19,7 @@ GLUE_OBJS = \
object.o \
paned.o \
selection.o \
selectiondata.o \
slist.o \
style.o \
type.o \

25
glue/selectiondata.c Normal file
View file

@ -0,0 +1,25 @@
/* selectiondata.c : Glue to access fields of GtkSelectionData
*
* Author: Mike Kestner <mkestner@speakeasy.net>
*
* <c> 2003 Novell, Inc.
*/
#include <gtk/gtkwidget.h>
#include <gtk/gtkselection.h>
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;
}

View file

@ -2,8 +2,8 @@
<metadata>
<attr path="/api/namespace/boxed[@cname='GtkBorder']" name="hidden">1</attr>
<attr path="/api/namespace/boxed[@cname='GtkIconSet']/method[@name='GetSizes']" name="hidden">1</attr>
<attr path="/api/namespace/boxed[@cname='GtkSelectionData']" name="opaque">1</attr>
<attr path="/api/namespace/boxed[@cname='GtkSelectionData']/method[@name='GetText']" name="hidden">1</attr>
<attr path="/api/namespace/boxed[@cname='GtkSelectionData']/method[@name='Set']" name="hidden">1</attr>
<attr path="/api/namespace/boxed[@cname='GtkSelectionData']/method[@name='SetText']" name="hidden">1</attr>
<attr path="/api/namespace/boxed[@cname='GtkTextIter']/method[@name='BackwardSearch']/*/*[@type='GtkTextIter*']" name="pass_as">out</attr>
<attr path="/api/namespace/boxed[@cname='GtkTextIter']/method[@name='BackwardToTagToggle']/*/*[@type='GtkTextTag*']" name="null_ok">1</attr>

View file

@ -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);
}
}

View file

@ -11428,7 +11428,7 @@
<field cname="ruler_scale" array_len="10" type="gdouble" />
<field cname="subdivide" array_len="5" type="gint" />
</struct>
<boxed name="SelectionData" cname="GtkSelectionData">
<boxed name="SelectionData" cname="GtkSelectionData" opaque="1">
<field cname="selection" type="GdkAtom" />
<field cname="target" type="GdkAtom" />
<field cname="type" type="GdkAtom" />
@ -11455,7 +11455,7 @@
<method name="GetType" cname="gtk_selection_data_get_type" shared="true">
<return-type type="GType" />
</method>
<method name="Set" cname="gtk_selection_data_set" hidden="1">
<method name="Set" cname="gtk_selection_data_set">
<return-type type="void" />
<parameters>
<parameter type="GdkAtom" name="type" />

View file

@ -331,7 +331,7 @@ public class TestDnd {
private static void HandleTargetDragDataReceived (object sender, DragDataReceivedArgs args)
{
if (args.SelectionData.length >=0 && args.SelectionData.format == 8) {
if (args.SelectionData.Length >=0 && args.SelectionData.Format == 8) {
Console.WriteLine ("Received {0} in trashcan", args.SelectionData);
Gtk.Drag.Finish (args.Context, true, false, args.Time);
}
@ -341,7 +341,7 @@ public class TestDnd {
private static void HandleLabelDragDataReceived (object sender, DragDataReceivedArgs args)
{
if (args.SelectionData.length >=0 && args.SelectionData.format == 8) {
if (args.SelectionData.Length >=0 && args.SelectionData.Format == 8) {
Console.WriteLine ("Received {0} in label", args.SelectionData);
Gtk.Drag.Finish (args.Context, true, false, args.Time);
}