mirror of
https://github.com/Ryujinx/GtkSharp.git
synced 2025-01-23 13:21:07 +00:00
2009-04-05 Christian Hoff <christian_hoff@gmx.net>
* gtk/Target.custom: custom implementation of TableNewFromList. * gtk/TargetList.custom: use Target.TableNewFromList method to convert the TargetList to a TargetEntry array. * gtk/glue/targetlist.c: deleted. svn path=/trunk/gtk-sharp/; revision=131066
This commit is contained in:
parent
30b112fb2a
commit
80632de9e5
|
@ -1,3 +1,10 @@
|
|||
2009-04-05 Christian Hoff <christian_hoff@gmx.net>
|
||||
|
||||
* gtk/Target.custom: custom implementation of TableNewFromList.
|
||||
* gtk/TargetList.custom: use Target.TableNewFromList method
|
||||
to convert the TargetList to a TargetEntry array.
|
||||
* gtk/glue/targetlist.c: deleted.
|
||||
|
||||
2009-03-28 Christian Hoff <christian_hoff@gmx.net>
|
||||
|
||||
* gtk/TextBuffer.custom: Use the right overload of Marshal.Copy
|
||||
|
|
|
@ -109,6 +109,7 @@
|
|||
<attr path="/api/namespace/class[@cname='GtkRc_']/method[@name='SetDefaultFiles']/*/*[@name='filenames']" name="null_term_array">1</attr>
|
||||
<attr path="/api/namespace/class[@cname='GtkSignal_']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/class[@cname='GtkStock_']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/class[@cname='GtkTarget_']/method[@name='TableNewFromList']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/class[@cname='GtkTimeout_']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/class[@cname='GtkTree_']/method[@name='GetRowDragData']/*/*[@name='tree_model']" name="pass_as">out</attr>
|
||||
<attr path="/api/namespace/class[@cname='GtkTree_']/method[@name='GetRowDragData']/*/*[@name='path']" name="pass_as">out</attr>
|
||||
|
|
|
@ -108,6 +108,7 @@ customs = \
|
|||
StockItem.custom \
|
||||
Style.custom \
|
||||
Table.custom \
|
||||
Target.custom \
|
||||
TargetEntry.custom \
|
||||
TargetList.custom \
|
||||
TargetPair.custom \
|
||||
|
|
36
gtk/Target.custom
Normal file
36
gtk/Target.custom
Normal file
|
@ -0,0 +1,36 @@
|
|||
// Gtk.Target.custom - Gtk.Target class customizations
|
||||
//
|
||||
// Author: Christian Hoff <christian_hoff@gmx.net>
|
||||
//
|
||||
// Copyright (c) 2009 Christian Hoff
|
||||
//
|
||||
// This code is inserted after the automatically generated code.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of version 2 of the Lesser GNU General
|
||||
// Public License as published by the Free Software Foundation.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this program; if not, write to the
|
||||
// Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
// Boston, MA 02111-1307, USA.
|
||||
|
||||
[DllImport("libgtk-win32-2.0-0.dll")]
|
||||
static extern IntPtr gtk_target_table_new_from_list(IntPtr list, out int n_targets);
|
||||
|
||||
public static Gtk.TargetEntry[] TableNewFromList(Gtk.TargetList list) {
|
||||
int n_targets;
|
||||
IntPtr array_ptr = gtk_target_table_new_from_list (list.Handle, out n_targets);
|
||||
|
||||
Gtk.TargetEntry[] ret = new Gtk.TargetEntry [n_targets];
|
||||
int unmanaged_struct_size = Marshal.SizeOf (typeof (Gtk.TargetEntry));
|
||||
for (int i = 0; i < n_targets; i++) {
|
||||
ret [i] = Gtk.TargetEntry.New (new IntPtr (array_ptr.ToInt64 () + i * unmanaged_struct_size));
|
||||
}
|
||||
return ret;
|
||||
}
|
|
@ -35,16 +35,7 @@
|
|||
Remove(Gdk.Atom.Intern (target, false));
|
||||
}
|
||||
|
||||
[DllImport("gtksharpglue-2")]
|
||||
static extern int gtksharp_target_list_length (IntPtr list);
|
||||
|
||||
[DllImport("gtksharpglue-2")]
|
||||
static extern void gtksharp_target_list_to_entry_array (IntPtr list, [In, Out] TargetEntry[] entries);
|
||||
|
||||
public static explicit operator TargetEntry[] (TargetList list)
|
||||
{
|
||||
int length = gtksharp_target_list_length (list.Handle);
|
||||
TargetEntry[] entries = new TargetEntry[length];
|
||||
gtksharp_target_list_to_entry_array (list.Handle, entries);
|
||||
return entries;
|
||||
return Target.TableNewFromList (list);
|
||||
}
|
||||
|
|
|
@ -9,7 +9,6 @@ libgtksharpglue_2_la_SOURCES = \
|
|||
selectiondata.c \
|
||||
statusicon.c \
|
||||
style.c \
|
||||
targetlist.c \
|
||||
vmglueheaders.h \
|
||||
widget.c
|
||||
|
||||
|
|
|
@ -1,44 +0,0 @@
|
|||
/*
|
||||
* Utilities for GtkTargetList
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of version 2 of the Lesser GNU General
|
||||
* Public License as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <gtk/gtkselection.h>
|
||||
|
||||
/* forward declarations */
|
||||
int gtksharp_target_list_length (GtkTargetList *list);
|
||||
void gtksharp_target_list_to_entry_array (GtkTargetList *list, GtkTargetEntry *entries);
|
||||
/* */
|
||||
|
||||
int
|
||||
gtksharp_target_list_length (GtkTargetList *list)
|
||||
{
|
||||
return g_list_length (list->list);
|
||||
}
|
||||
|
||||
void
|
||||
gtksharp_target_list_to_entry_array (GtkTargetList *list, GtkTargetEntry *entries)
|
||||
{
|
||||
GList *l;
|
||||
int i;
|
||||
|
||||
for (l = list->list, i = 0; l; l = l->next, i++) {
|
||||
GtkTargetPair *pair = (GtkTargetPair *)l->data;
|
||||
entries[i].target = gdk_atom_name (pair->target);
|
||||
entries[i].flags = pair->flags;
|
||||
entries[i].info = pair->info;
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue