mirror of
https://github.com/Ryujinx/GtkSharp.git
synced 2024-12-23 17:35:33 +00:00
* gtk/TargetList.custom: add an operator for casting to
TargetEntry[], so you can use methods like TargetList.AddTextTargets() in situations where you need a TargetEntry[] rather than a TargetList. * gtk/glue/targetlist.c: glue for that svn path=/trunk/gtk-sharp/; revision=48006
This commit is contained in:
parent
3e19a1d102
commit
dc9046526c
|
@ -1,3 +1,12 @@
|
|||
2005-08-04 Dan Winship <danw@novell.com>
|
||||
|
||||
* gtk/TargetList.custom: add an operator for casting to
|
||||
TargetEntry[], so you can use methods like
|
||||
TargetList.AddTextTargets() in situations where you need a
|
||||
TargetEntry[] rather than a TargetList.
|
||||
|
||||
* gtk/glue/targetlist.c: glue for that
|
||||
|
||||
2005-08-04 Mike Kestner <mkestner@novell.com>
|
||||
|
||||
* generator/Ctor.cs : call Finish and HandleException for static ctor
|
||||
|
|
|
@ -185,9 +185,10 @@
|
|||
<Parameter Name="info" Type="System.UInt32" />
|
||||
</Parameters>
|
||||
<Docs>
|
||||
<summary>To be added</summary>
|
||||
<param name="info">a <see cref="T:System.UInt32" /></param>
|
||||
<remarks>To be added</remarks>
|
||||
<summary>Adds the target types for URIs to the target list</summary>
|
||||
<param name="info">application-defined ID for these target types</param>
|
||||
<remarks>Appends the URI targets supported by <see cref="T:Gtk.Selection" /> to the target list. All targets are
|
||||
added with the same <paramref name="info" />.</remarks>
|
||||
<since version="Gtk# 2.6" />
|
||||
</Docs>
|
||||
</Member>
|
||||
|
@ -202,10 +203,11 @@
|
|||
<Parameter Name="writable" Type="System.Boolean" />
|
||||
</Parameters>
|
||||
<Docs>
|
||||
<summary>To be added</summary>
|
||||
<param name="info">a <see cref="T:System.UInt32" /></param>
|
||||
<param name="writable">a <see cref="T:System.Boolean" /></param>
|
||||
<remarks>To be added</remarks>
|
||||
<summary>Adds the target types for images to the target list</summary>
|
||||
<param name="info">application-defined ID for these target types</param>
|
||||
<param name="writable">if <see langword="true" />, only add the target types for which Gtk knows how to convert a <see cref="T:Gdk.Pixbuf" /> to the format.</param>
|
||||
<remarks>Appends the image targets supported by <see cref="T:Gtk.Selection" /> to the target list. All targets are
|
||||
added with the same <paramref name="info" />.</remarks>
|
||||
<since version="Gtk# 2.6" />
|
||||
</Docs>
|
||||
</Member>
|
||||
|
@ -219,11 +221,28 @@
|
|||
<Parameter Name="info" Type="System.UInt32" />
|
||||
</Parameters>
|
||||
<Docs>
|
||||
<summary>To be added</summary>
|
||||
<param name="info">a <see cref="T:System.UInt32" /></param>
|
||||
<remarks>To be added</remarks>
|
||||
<summary>Adds the target types for text to the target list</summary>
|
||||
<param name="info">application-defined ID for these target types</param>
|
||||
<remarks>Appends the text targets supported by <see cref="T:Gtk.Selection" /> to the target list. All targets are
|
||||
added with the same <paramref name="info" />.</remarks>
|
||||
<since version="Gtk# 2.6" />
|
||||
</Docs>
|
||||
</Member>
|
||||
<Member MemberName="op_Explicit">
|
||||
<MemberSignature Language="C#" Value="public static Gtk.TargetEntry[] op_Explicit (Gtk.TargetList list);" />
|
||||
<MemberType>Method</MemberType>
|
||||
<ReturnValue>
|
||||
<ReturnType>Gtk.TargetEntry[]</ReturnType>
|
||||
</ReturnValue>
|
||||
<Parameters>
|
||||
<Parameter Name="list" Type="Gtk.TargetList" />
|
||||
</Parameters>
|
||||
<Docs>
|
||||
<param name="list">A <see cref="T:Gtk.TargetList" />.</param>
|
||||
<summary>Converts a <see cref="T:Gtk.TargetList" /> to an array of <see cref="T:Gtk.TargetEntry" />.</summary>
|
||||
<returns>An equivalent array of <see cref="T:Gtk.TargetEntry" />.</returns>
|
||||
<remarks />
|
||||
</Docs>
|
||||
</Member>
|
||||
</Members>
|
||||
</Type>
|
||||
|
|
|
@ -34,3 +34,17 @@
|
|||
public void Remove(string target) {
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ libgtksharpglue_2_la_SOURCES = \
|
|||
object.c \
|
||||
selectiondata.c \
|
||||
style.c \
|
||||
targetlist.c \
|
||||
vmglueheaders.h \
|
||||
widget.c
|
||||
|
||||
|
|
44
gtk/glue/targetlist.c
Normal file
44
gtk/glue/targetlist.c
Normal file
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
* 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