2005-04-05 Mike Kestner <mkestner@novell.com>

* gtk/DestroyHelper.cs : implement an internal DestroyNotify handler 
	to release GCHandles.
	* gtk/*.custom : rework existing persistent delegate implementations
	to use destroy notify or PersistentData.

svn path=/trunk/gtk-sharp/; revision=42571
This commit is contained in:
Mike Kestner 2005-04-05 14:48:49 +00:00
parent 35c2cf0086
commit 23ec73d6f9
19 changed files with 397 additions and 280 deletions

View file

@ -1,3 +1,10 @@
2005-04-05 Mike Kestner <mkestner@novell.com>
* gtk/DestroyHelper.cs : implement an internal DestroyNotify handler
to release GCHandles.
* gtk/*.custom : rework existing persistent delegate implementations
to use destroy notify or PersistentData.
2005-04-05 Alp Toker <alp@atoker.com>
* gtk/Menu.custom: don't re-implement the Screen getter in Gtk.Menu.

View file

@ -51,10 +51,10 @@
<Parameters />
<Docs>
<summary>
Returns the number of children that <paramref name="iter"/> has.
Returns the number of children that <paramref name="iter" /> has.
</summary>
<returns>an object of type <see cref="T:System.Int32" />, the number of children of <paramref name="iter"/>.</returns>
<remarks>As a special case, if <paramref name="iter"/> is <see langword="null"/>, then the number
<returns>an object of type <see cref="T:System.Int32" />, the number of children of <paramref name="iter" />.</returns>
<remarks>As a special case, if <paramref name="iter" /> is <see langword="null" />, then the number
of toplevel nodes is returned.</remarks>
</Docs>
</Member>
@ -69,22 +69,21 @@
</Parameters>
<Docs>
<summary>
Sets <paramref name="iter"/> to point to the first child of <paramref name="parent"/>.
Sets <paramref name="iter" /> to point to the first child of <paramref name="parent" />.
</summary>
<param name="iter">an object of type <see cref="T:Gtk.TreeIter" /></param>
<returns>an object of type <see cref="T:System.Boolean" />,
<see langword="true"/>, if <paramref name="child"/> has been set to the first child.</returns>
<see langword="true" />, if <paramref name="child" /> has been set to the first child.</returns>
<remarks>
<para>
If <paramref name="parent"/> has no children,
<see langword="false"/> is returned and <paramref name="iter"/> is set to be invalid. <paramref name="parent"/> will remain a valid
<para>
If <paramref name="parent" /> has no children,
<see langword="false" /> is returned and <paramref name="iter" /> is set to be invalid. <paramref name="parent" /> will remain a valid
node after this function has been called.
</para>
<para>
If <paramref name="parent"/> is <see langword="null"/> returns the first node, equivalent to
<literal>gtk_tree_model_get_iter_first (tree_model, iter);</literal>
</para>
</remarks>
<para>
If <paramref name="parent" /> is <see langword="null" /> returns the first node, equivalent to
<literal>gtk_tree_model_get_iter_first (tree_model, iter);</literal></para>
</remarks>
</Docs>
</Member>
<Member MemberName="ChangeSortColumn">
@ -129,13 +128,12 @@
<Parameter Name="destroy" Type="Gtk.DestroyNotify" />
</Parameters>
<Docs>
<summary>Sets a sort function to be used for the column
<paramref name="sort_column_id" />.</summary>
<summary>Sets a sort function to be used for the column <paramref name="sort_column_id" />.</summary>
<param name="sort_column_id">A <see cref="T:System.Int32" /> for the column number.</param>
<param name="sort_func">A <see cref="T:Gtk.TreeIterCompareFunc" /></param>
<param name="user_data">A <see cref="T:IntPtr" /></param>
<param name="destroy">A <see cref="T:Gtk.DestroyNotify" />, function that will be run on destruction of <paramref name="user_data" /></param>
<remarks />
<param name="user_data">ignored</param>
<param name="destroy">ignored</param>
<remarks>This overload is obsolete. The two parameter overload is preferred for new code. </remarks>
</Docs>
</Member>
<Member MemberName="SetDefaultSortFunc">
@ -152,9 +150,9 @@
<Docs>
<summary>Set the function that will be used by default to sort columns.</summary>
<param name="sort_func">A <see cref="T:Gtk.TreeIterCompareFunc" /></param>
<param name="user_data">A <see cref="T:IntPtr" /> (FIXME: explain this)</param>
<param name="destroy">A <see cref="T:Gtk.DestroyNotify" />, function that will be run on destruction of <paramref name="user_data" /></param>
<remarks />
<param name="user_data">ignored</param>
<param name="destroy">ignored</param>
<remarks>This overload is obsolete. The single parameter overload is preferred for new code. </remarks>
</Docs>
</Member>
<Member MemberName="RowDropPossible">
@ -1432,7 +1430,40 @@ The above example creates a new three columns list store. The types of the colum
<Docs>
<summary>Protected constructor.</summary>
<returns>a <see cref="T:Gtk.ListStore" /></returns>
<remarks></remarks>
<remarks>
</remarks>
</Docs>
</Member>
<Member MemberName="SetSortFunc">
<MemberSignature Language="C#" Value="public virtual void SetSortFunc (int sort_column_id, Gtk.TreeIterCompareFunc sort_func);" />
<MemberType>Method</MemberType>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="sort_column_id" Type="System.Int32" />
<Parameter Name="sort_func" Type="Gtk.TreeIterCompareFunc" />
</Parameters>
<Docs>
<summary>Sets a sort function to be used for the column <paramref name="sort_column_id" />.</summary>
<param name="sort_column_id">A <see cref="T:System.Int32" /> for the column number.</param>
<param name="sort_func">A <see cref="T:Gtk.TreeIterCompareFunc" /></param>
<remarks />
</Docs>
</Member>
<Member MemberName="SetDefaultSortFunc">
<MemberSignature Language="C#" Value="public virtual void SetDefaultSortFunc (Gtk.TreeIterCompareFunc sort_func);" />
<MemberType>Method</MemberType>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="sort_func" Type="Gtk.TreeIterCompareFunc" />
</Parameters>
<Docs>
<summary>Set the function that will be used by default to sort columns.</summary>
<param name="sort_func">A <see cref="T:Gtk.TreeIterCompareFunc" /></param>
<remarks />
</Docs>
</Member>
</Members>

View file

@ -107,12 +107,12 @@ node is always the parent.</remarks>
<Parameter Name="destroy" Type="Gtk.DestroyNotify" />
</Parameters>
<Docs>
<summary>Sets a function that should be used to be sort a particular column.</summary>
<summary>Sets a function to sort a particular column.</summary>
<param name="sort_column_id">A <see cref="System.Int32" />, the index of the column to be sorted</param>
<param name="sort_func">A <see cref="TGtk.TreeIterCompareFunc" />, the function to use for sorting</param>
<param name="user_data">An <see cref="T:IntPtr" />, pointer to the user data, or <see langword="null" /></param>
<param name="destroy">A <see cref="Gtk.DestroyNotify" /> to be called when user data is destroyed, or <see langword="null" />.</param>
<remarks>This method is meant to be used together with <see cref="T:Gtk.TreeModelSort.ChangeSortColumn" />.(FIXME: explain the user data parameter.)</remarks>
<param name="user_data">ignored</param>
<param name="destroy">ignored</param>
<remarks>This overload is obsolete. The two parameter overload is preferred for new code.</remarks>
</Docs>
</Member>
<Member MemberName="SetDefaultSortFunc">
@ -129,9 +129,9 @@ node is always the parent.</remarks>
<Docs>
<summary>Sets a function that should be used to be sort columns by default if not otherwise specified by <see cref="T:Gtk.TreeModelSort.SetSortFunc" />.</summary>
<param name="sort_func">A <see cref="TGtk.TreeIterCompareFunc" />, the function to use for sorting</param>
<param name="user_data">An <see cref="T:IntPtr" />, pointer to the user data, or <see langword="null" /></param>
<param name="destroy">A <see cref="Gtk.DestroyNotify" /> to be called when user data is destroyed, or <see langword="null" />.</param>
<remarks>This method is meant to be used together with <see cref="T:Gtk.TreeModelSort.ChangeSortColumn" />.(FIXME: explain the user data parameter.)</remarks>
<param name="user_data">ignored</param>
<param name="destroy">ignored</param>
<remarks>This overload is obsolete. The single parameter overload is preferred for new code.</remarks>
</Docs>
</Member>
<Member MemberName="EmitRowChanged">
@ -1156,5 +1156,37 @@ node is always the parent.</remarks>
<remarks />
</Docs>
</Member>
<Member MemberName="SetSortFunc">
<MemberSignature Language="C#" Value="public virtual void SetSortFunc (int sort_column_id, Gtk.TreeIterCompareFunc sort_func);" />
<MemberType>Method</MemberType>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="sort_column_id" Type="System.Int32" />
<Parameter Name="sort_func" Type="Gtk.TreeIterCompareFunc" />
</Parameters>
<Docs>
<summary>Sets a function to sort a particular column.</summary>
<param name="sort_column_id">A <see cref="System.Int32" />, the index of the column to be sorted</param>
<param name="sort_func">A <see cref="TGtk.TreeIterCompareFunc" />, the function to use for sorting</param>
<remarks>This method is meant to be used together with <see cref="T:Gtk.TreeModelSort.ChangeSortColumn" />.</remarks>
</Docs>
</Member>
<Member MemberName="SetDefaultSortFunc">
<MemberSignature Language="C#" Value="public virtual void SetDefaultSortFunc (Gtk.TreeIterCompareFunc sort_func);" />
<MemberType>Method</MemberType>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="sort_func" Type="Gtk.TreeIterCompareFunc" />
</Parameters>
<Docs>
<summary>Sets a function to sort columns by default if not otherwise specified by <see cref="T:Gtk.TreeModelSort.SetSortFunc" />.</summary>
<param name="sort_func">A <see cref="TGtk.TreeIterCompareFunc" />, the function to use for sorting</param>
<remarks>This method is meant to be used together with <see cref="T:Gtk.TreeModelSort.ChangeSortColumn" />.</remarks>
</Docs>
</Member>
</Members>
</Type>
</Type>

View file

@ -66,9 +66,9 @@
<summary>Sets a function that should be used to be sort a particular column.</summary>
<param name="sort_column_id">A <see cref="System.Int32" />, the index of the column to be sorted</param>
<param name="sort_func">A <see cref="TGtk.TreeIterCompareFunc" />, the function to use for sorting</param>
<param name="user_data">An <see cref="T:IntPtr" />, pointer to the user data, or <see langword="null" /></param>
<param name="destroy">A <see cref="Gtk.DestroyNotify" /> to be called when user data is destroyed, or <see langword="null" />.</param>
<remarks>This method is meant to be used together with <see cref="T:Gtk.TreeModelSort.ChangeSortColumn" />.(FIXME: explain the user data parameter.)</remarks>
<param name="user_data">ignored</param>
<param name="destroy">ignored</param>
<remarks>This overloaded method is obsolete. It is replaced by the SetSortFunc (int, TreeIterCompareFunc) overload." />.</remarks>
</Docs>
</Member>
<Member MemberName="SetDefaultSortFunc">
@ -83,11 +83,11 @@
<Parameter Name="destroy" Type="Gtk.DestroyNotify" />
</Parameters>
<Docs>
<summary>Sets a function that should be used to be sort columns by default if not otherwise specified by <see cref="T:Gtk.TreeModelSort.SetSortFunc" />.</summary>
<summary>Sets a function to sort columns by default if not otherwise specified by <see cref="T:Gtk.TreeModelSort.SetSortFunc" />.</summary>
<param name="sort_func">A <see cref="TGtk.TreeIterCompareFunc" />, the function to use for sorting</param>
<param name="user_data">An <see cref="T:IntPtr" />, pointer to the user data, or <see langword="null" /></param>
<param name="destroy">A <see cref="Gtk.DestroyNotify" /> to be called when user data is destroyed, or <see langword="null" />.</param>
<remarks>This method is meant to be used together with <see cref="T:Gtk.TreeModelSort.ChangeSortColumn" />.(FIXME: explain the user data parameter.)</remarks>
<param name="user_data">ignored</param>
<param name="destroy">ignored</param>
<remarks>This overload of SetDefaultSortFunc is obsolete. The replacement is a single parameter overload. The <paramref name="data"/> and <paramref name="destroy"/> paramaters to this method are ignored. </remarks>
</Docs>
</Member>
<Member MemberName="SortColumnChanged">
@ -133,5 +133,37 @@
<remarks>See <see cref="M:Gtk.TreeModelSort.SetDefaultSortFunc" /> to set a default sort function.</remarks>
</Docs>
</Member>
<Member MemberName="SetDefaultSortFunc">
<MemberSignature Language="C#" Value="public virtual void SetDefaultSortFunc (Gtk.TreeIterCompareFunc sort_func);" />
<MemberType>Method</MemberType>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="sort_func" Type="Gtk.TreeIterCompareFunc" />
</Parameters>
<Docs>
<summary>Sets a function to sort columns by default if not otherwise specified by <see cref="T:Gtk.TreeModelSort.SetSortFunc" />.</summary>
<param name="sort_func">A <see cref="TGtk.TreeIterCompareFunc" />, the function to use for sorting</param>
<remarks>This method is meant to be used together with <see cref="T:Gtk.TreeModelSort.ChangeSortColumn" /></remarks>
</Docs>
</Member>
<Member MemberName="SetSortFunc">
<MemberSignature Language="C#" Value="public virtual void SetSortFunc (int sort_column_id, Gtk.TreeIterCompareFunc sort_func);" />
<MemberType>Method</MemberType>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="sort_column_id" Type="System.Int32" />
<Parameter Name="sort_func" Type="Gtk.TreeIterCompareFunc" />
</Parameters>
<Docs>
<summary>Sets a function that should be used to be sort a particular column.</summary>
<param name="sort_column_id">A <see cref="System.Int32" />, the index of the column to be sorted</param>
<param name="sort_func">A <see cref="TGtk.TreeIterCompareFunc" />, the function to use for sorting</param>
<remarks>This method is meant to be used together with <see cref="T:Gtk.TreeModelSort.ChangeSortColumn" /></remarks>
</Docs>
</Member>
</Members>
</Type>
</Type>

View file

@ -149,9 +149,9 @@
<summary>Sets a function that should be used to be sort a particular column.</summary>
<param name="sort_column_id">A <see cref="System.Int32" />, the index of the column to be sorted</param>
<param name="sort_func">A <see cref="TGtk.TreeIterCompareFunc" />, the function to use for sorting</param>
<param name="user_data">An <see cref="T:IntPtr" />, pointer to the user data, or <see langword="null" /></param>
<param name="destroy">A <see cref="Gtk.DestroyNotify" /> to be called when user data is destroyed, or <see langword="null" />.</param>
<remarks>This method is meant to be used together with <see cref="T:Gtk.TreeModelSort.ChangeSortColumn" />.(FIXME: explain the user data parameter.)</remarks>
<param name="user_data">ignored</param>
<param name="destroy">ignored</param>
<remarks>This overload is obsolete. The two parameter is preferred for new code.</remarks>
</Docs>
</Member>
<Member MemberName="SetDefaultSortFunc">
@ -168,9 +168,9 @@
<Docs>
<summary>Sets a function that should be used to be sort columns by default if not otherwise specified by <see cref="T:Gtk.TreeModelSort.SetSortFunc" />.</summary>
<param name="sort_func">A <see cref="TGtk.TreeIterCompareFunc" />, the function to use for sorting</param>
<param name="user_data">An <see cref="T:IntPtr" />, pointer to the user data, or <see langword="null" /></param>
<param name="destroy">A <see cref="Gtk.DestroyNotify" /> to be called when user data is destroyed, or <see langword="null" />.</param>
<remarks>This method is meant to be used together with <see cref="T:Gtk.TreeModelSort.ChangeSortColumn" />.(FIXME: explain the user data parameter.)</remarks>
<param name="user_data">ignored</param>
<param name="destroy">ignored</param>
<remarks>This overload is obsolete. The single parameter overload is preferred for new code.</remarks>
</Docs>
</Member>
<Member MemberName="RowDropPossible">
@ -1744,5 +1744,37 @@ store = new TreeStore (typeof (int), typeof (string));
<remarks />
</Docs>
</Member>
<Member MemberName="SetSortFunc">
<MemberSignature Language="C#" Value="public virtual void SetSortFunc (int sort_column_id, Gtk.TreeIterCompareFunc sort_func);" />
<MemberType>Method</MemberType>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="sort_column_id" Type="System.Int32" />
<Parameter Name="sort_func" Type="Gtk.TreeIterCompareFunc" />
</Parameters>
<Docs>
<summary>Sets a function that should be used to be sort a particular column.</summary>
<param name="sort_column_id">A <see cref="System.Int32" />, the index of the column to be sorted</param>
<param name="sort_func">A <see cref="TGtk.TreeIterCompareFunc" />, the function to use for sorting</param>
<remarks>This method is meant to be used together with <see cref="T:Gtk.TreeModelSort.ChangeSortColumn" /></remarks>
</Docs>
</Member>
<Member MemberName="SetDefaultSortFunc">
<MemberSignature Language="C#" Value="public virtual void SetDefaultSortFunc (Gtk.TreeIterCompareFunc sort_func);" />
<MemberType>Method</MemberType>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="sort_func" Type="Gtk.TreeIterCompareFunc" />
</Parameters>
<Docs>
<summary>Sets a function that should be used to be sort columns by default if not otherwise specified by <see cref="T:Gtk.TreeModelSort.SetSortFunc" />.</summary>
<param name="sort_func">A <see cref="TGtk.TreeIterCompareFunc" />, the function to use for sorting</param>
<remarks>This method is meant to be used together with <see cref="T:Gtk.TreeModelSort.ChangeSortColumn" />.</remarks>
</Docs>
</Member>
</Members>
</Type>

View file

@ -43,8 +43,7 @@
[Obsolete("Moved to AccelMap class. Use AccelMap.ForeachUnfiltered instead")]
public static void MapForeachUnfiltered(IntPtr data, Gtk.AccelMapForeach foreach_func) {
GtkSharp.AccelMapForeachWrapper foreach_func_wrapper = null;
foreach_func_wrapper = new GtkSharp.AccelMapForeachWrapper (foreach_func);
GtkSharp.AccelMapForeachWrapper foreach_func_wrapper = new GtkSharp.AccelMapForeachWrapper (foreach_func);
gtk_accel_map_foreach_unfiltered(data, foreach_func_wrapper.NativeDelegate);
}
@ -111,8 +110,7 @@
[Obsolete("Moved to AccelMap class. Use AccelMap.Foreach instead")]
public static void MapForeach(IntPtr data, Gtk.AccelMapForeach foreach_func) {
GtkSharp.AccelMapForeachWrapper foreach_func_wrapper = null;
foreach_func_wrapper = new GtkSharp.AccelMapForeachWrapper (foreach_func);
GtkSharp.AccelMapForeachWrapper foreach_func_wrapper = new GtkSharp.AccelMapForeachWrapper (foreach_func);
gtk_accel_map_foreach(data, foreach_func_wrapper.NativeDelegate);
}

View file

@ -21,15 +21,6 @@
// Boston, MA 02111-1307, USA.
Hashtable datafuncs;
Hashtable DataFuncs {
get {
if (datafuncs == null)
datafuncs = new Hashtable ();
return datafuncs;
}
}
public void SetAttributes (CellRenderer cell, params object[] attrs)
{
if (attrs.Length % 2 != 0)
@ -42,21 +33,17 @@
}
[DllImport("libgtk-win32-2.0-0.dll")]
static extern void gtk_cell_layout_set_cell_data_func(IntPtr raw, IntPtr cell_renderer, IntPtr func, IntPtr func_data, IntPtr destroy);
[DllImport("libgtk-win32-2.0-0.dll")]
static extern void gtk_cell_layout_set_cell_data_func(IntPtr raw, IntPtr cell_renderer, GtkSharp.CellLayoutDataFuncNative func, IntPtr func_data, IntPtr destroy);
static extern void gtk_cell_layout_set_cell_data_func(IntPtr raw, IntPtr cell_renderer, GtkSharp.CellLayoutDataFuncNative func, IntPtr func_data, NativeDestroyNotify destroy);
public void SetCellDataFunc (CellRenderer renderer, CellLayoutDataFunc func)
{
if (func == null) {
DataFuncs [renderer] = null;
gtk_cell_layout_set_cell_data_func (Handle, renderer.Handle, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero);
} else {
GtkSharp.CellLayoutDataFuncWrapper func_wrapper = new GtkSharp.CellLayoutDataFuncWrapper (func);
DataFuncs [renderer] = func_wrapper;
gtk_cell_layout_set_cell_data_func (Handle, renderer.Handle, func_wrapper.NativeDelegate, IntPtr.Zero, IntPtr.Zero);
gtk_cell_layout_set_cell_data_func (Handle, renderer.Handle, null, IntPtr.Zero, null);
return;
}
GtkSharp.CellLayoutDataFuncWrapper func_wrapper = new GtkSharp.CellLayoutDataFuncWrapper (func);
GCHandle gch = GCHandle.Alloc (func_wrapper);
gtk_cell_layout_set_cell_data_func (Handle, renderer.Handle, func_wrapper.NativeDelegate, (IntPtr) gch, DestroyHelper.NotifyHandler);
}

View file

@ -21,15 +21,6 @@
// Boston, MA 02111-1307, USA.
Hashtable datafuncs;
Hashtable DataFuncs {
get {
if (datafuncs == null)
datafuncs = new Hashtable ();
return datafuncs;
}
}
public void SetAttributes (CellRenderer cell, params object[] attrs)
{
if (attrs.Length % 2 != 0)
@ -42,21 +33,17 @@
}
[DllImport("libgtk-win32-2.0-0.dll")]
static extern void gtk_cell_layout_set_cell_data_func(IntPtr raw, IntPtr cell_renderer, IntPtr func, IntPtr func_data, IntPtr destroy);
[DllImport("libgtk-win32-2.0-0.dll")]
static extern void gtk_cell_layout_set_cell_data_func(IntPtr raw, IntPtr cell_renderer, GtkSharp.CellLayoutDataFuncNative func, IntPtr func_data, IntPtr destroy);
static extern void gtk_cell_layout_set_cell_data_func(IntPtr raw, IntPtr cell_renderer, GtkSharp.CellLayoutDataFuncNative func, IntPtr func_data, NativeDestroyNotify destroy);
public void SetCellDataFunc (CellRenderer renderer, CellLayoutDataFunc func)
{
if (func == null) {
DataFuncs [renderer] = null;
gtk_cell_layout_set_cell_data_func (Handle, renderer.Handle, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero);
} else {
GtkSharp.CellLayoutDataFuncWrapper func_wrapper = new GtkSharp.CellLayoutDataFuncWrapper (func);
DataFuncs [renderer] = func_wrapper;
gtk_cell_layout_set_cell_data_func (Handle, renderer.Handle, func_wrapper.NativeDelegate, IntPtr.Zero, IntPtr.Zero);
gtk_cell_layout_set_cell_data_func (Handle, renderer.Handle, null, IntPtr.Zero, null);
return;
}
GtkSharp.CellLayoutDataFuncWrapper func_wrapper = new GtkSharp.CellLayoutDataFuncWrapper (func);
GCHandle gch = GCHandle.Alloc (func_wrapper);
gtk_cell_layout_set_cell_data_func (Handle, renderer.Handle, func_wrapper.NativeDelegate, (IntPtr) gch, DestroyHelper.NotifyHandler);
}

51
gtk/DestroyHelper.cs Normal file
View file

@ -0,0 +1,51 @@
// Gtk.DestroyHelper.cs - internal DestroyNotify helper
//
// Author: Mike Kestner <mkestner@novell.com>
//
// Copyright (c) 2005 Novell, Inc.
//
// 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.
namespace Gtk {
using System;
using System.Runtime.InteropServices;
internal delegate void NativeDestroyNotify (IntPtr data);
internal class DestroyHelper {
private DestroyHelper () {}
static void ReleaseGCHandle (IntPtr data)
{
if (data == IntPtr.Zero)
return;
GCHandle gch = (GCHandle) data;
gch.Free ();
}
static NativeDestroyNotify release_gchandle;
internal static NativeDestroyNotify NotifyHandler {
get {
if (release_gchandle == null)
release_gchandle = new NativeDestroyNotify (ReleaseGCHandle);
return release_gchandle;
}
}
}
}

View file

@ -21,15 +21,6 @@
// Boston, MA 02111-1307, USA.
Hashtable datafuncs;
Hashtable DataFuncs {
get {
if (datafuncs == null)
datafuncs = new Hashtable ();
return datafuncs;
}
}
public void SetAttributes (CellRenderer cell, params object[] attrs)
{
if (attrs.Length % 2 != 0)
@ -42,21 +33,17 @@
}
[DllImport("libgtk-win32-2.0-0.dll")]
static extern void gtk_cell_layout_set_cell_data_func(IntPtr raw, IntPtr cell_renderer, IntPtr func, IntPtr func_data, IntPtr destroy);
[DllImport("libgtk-win32-2.0-0.dll")]
static extern void gtk_cell_layout_set_cell_data_func(IntPtr raw, IntPtr cell_renderer, GtkSharp.CellLayoutDataFuncNative func, IntPtr func_data, IntPtr destroy);
static extern void gtk_cell_layout_set_cell_data_func(IntPtr raw, IntPtr cell_renderer, GtkSharp.CellLayoutDataFuncNative func, IntPtr func_data, NativeDestroyNotify destroy);
public void SetCellDataFunc (CellRenderer renderer, CellLayoutDataFunc func)
{
if (func == null) {
DataFuncs [renderer] = null;
gtk_cell_layout_set_cell_data_func (Handle, renderer.Handle, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero);
} else {
GtkSharp.CellLayoutDataFuncWrapper func_wrapper = new GtkSharp.CellLayoutDataFuncWrapper (func);
DataFuncs [renderer] = func_wrapper;
gtk_cell_layout_set_cell_data_func (Handle, renderer.Handle, func_wrapper.NativeDelegate, IntPtr.Zero, IntPtr.Zero);
gtk_cell_layout_set_cell_data_func (Handle, renderer.Handle, null, IntPtr.Zero, null);
return;
}
GtkSharp.CellLayoutDataFuncWrapper func_wrapper = new GtkSharp.CellLayoutDataFuncWrapper (func);
GCHandle gch = GCHandle.Alloc (func_wrapper);
gtk_cell_layout_set_cell_data_func (Handle, renderer.Handle, func_wrapper.NativeDelegate, (IntPtr) gch, DestroyHelper.NotifyHandler);
}

View file

@ -377,6 +377,7 @@
<attr path="/api/namespace/object[@cname='GtkTreeViewColumn']/method[@name='PackEnd']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkTreeViewColumn']/method[@name='PackStart']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkTreeViewColumn']/method[@name='SetAttributes']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkTreeViewColumn']/method[@name='SetCellDataFunc']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkTreeView']/method[@name='EnableModelDragDest']/*/*[@name='targets']" name="array">1</attr>
<attr path="/api/namespace/object[@cname='GtkTreeView']/method[@name='EnableModelDragSource']/*/*[@name='targets']" name="array">1</attr>
<attr path="/api/namespace/object[@cname='GtkTreeView']/method[@name='GetCellArea']/*/*[@name='rect']" name="pass_as">out</attr>

View file

@ -151,44 +151,44 @@
}
[DllImport("libgtk-win32-2.0-0.dll")]
static extern void gtk_tree_sortable_set_sort_func(IntPtr raw, int col_id, IntPtr sort_func, IntPtr user_data, IntPtr destroy);
[DllImport("libgtk-win32-2.0-0.dll")]
static extern void gtk_tree_sortable_set_sort_func(IntPtr raw, int col_id, GtkSharp.TreeIterCompareFuncNative sort_func, IntPtr user_data, GtkSharp.DestroyNotifyNative destroy);
static extern void gtk_tree_sortable_set_sort_func(IntPtr raw, int col_id, GtkSharp.TreeIterCompareFuncNative sort_func, IntPtr user_data, NativeDestroyNotify destroy);
[Obsolete ("Replaced by SetSortFunc (int, TreeIterCompareFunc) overload.")]
public void SetSortFunc (int sort_column_id, TreeIterCompareFunc sort_func, IntPtr user_data, Gtk.DestroyNotify destroy)
{
if (sort_func == null) {
PersistentData ["column_" + sort_column_id + "_sort_func"] = null;
gtk_tree_sortable_set_sort_func (Handle, sort_column_id, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero);
return;
}
GtkSharp.TreeIterCompareFuncWrapper sort_func_wrapper = new GtkSharp.TreeIterCompareFuncWrapper (sort_func);
PersistentData ["column_" + sort_column_id + "_sort_func"] = sort_func_wrapper;
GtkSharp.DestroyNotifyWrapper destroy_wrapper = null;
destroy_wrapper = new GtkSharp.DestroyNotifyWrapper (destroy);
gtk_tree_sortable_set_sort_func(Handle, sort_column_id, sort_func_wrapper.NativeDelegate, user_data, destroy_wrapper.NativeDelegate);
SetSortFunc (sort_column_id, sort_func);
}
[DllImport("libgtk-win32-2.0-0.dll")]
static extern void gtk_tree_sortable_set_default_sort_func(IntPtr raw, IntPtr sort_func, IntPtr user_data, IntPtr destroy);
[DllImport("libgtk-win32-2.0-0.dll")]
static extern void gtk_tree_sortable_set_default_sort_func(IntPtr raw, GtkSharp.TreeIterCompareFuncNative sort_func, IntPtr user_data, GtkSharp.DestroyNotifyNative destroy);
public void SetDefaultSortFunc (TreeIterCompareFunc sort_func, IntPtr user_data, Gtk.DestroyNotify destroy)
public void SetSortFunc (int sort_column_id, TreeIterCompareFunc sort_func)
{
if (sort_func == null) {
PersistentData ["default_sort_func"] = null;
gtk_tree_sortable_set_default_sort_func (Handle, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero);
gtk_tree_sortable_set_sort_func (Handle, sort_column_id, null, IntPtr.Zero, null);
return;
}
GtkSharp.TreeIterCompareFuncWrapper sort_func_wrapper = new GtkSharp.TreeIterCompareFuncWrapper (sort_func);
PersistentData ["default_sort_func"] = sort_func_wrapper;
GtkSharp.DestroyNotifyWrapper destroy_wrapper = null;
destroy_wrapper = new GtkSharp.DestroyNotifyWrapper (destroy);
gtk_tree_sortable_set_default_sort_func(Handle, sort_func_wrapper.NativeDelegate, user_data, destroy_wrapper.NativeDelegate);
GCHandle gch = GCHandle.Alloc (sort_func_wrapper);
gtk_tree_sortable_set_sort_func(Handle, sort_column_id, sort_func_wrapper.NativeDelegate, (IntPtr) gch, DestroyHelper.NotifyHandler);
}
[DllImport("libgtk-win32-2.0-0.dll")]
static extern void gtk_tree_sortable_set_default_sort_func(IntPtr raw, GtkSharp.TreeIterCompareFuncNative sort_func, IntPtr user_data, NativeDestroyNotify destroy);
[Obsolete ("Replaced by SetDefaultSortFunc (TreeIterCompareFunc) overload.")]
public void SetDefaultSortFunc (TreeIterCompareFunc sort_func, IntPtr user_data, Gtk.DestroyNotify destroy)
{
SetDefaultSortFunc (sort_func);
}
public void SetDefaultSortFunc (TreeIterCompareFunc sort_func)
{
if (sort_func == null) {
gtk_tree_sortable_set_default_sort_func (Handle, null, IntPtr.Zero, null);
return;
}
GtkSharp.TreeIterCompareFuncWrapper sort_func_wrapper = new GtkSharp.TreeIterCompareFuncWrapper (sort_func);
GCHandle gch = GCHandle.Alloc (sort_func_wrapper);
gtk_tree_sortable_set_default_sort_func(Handle, sort_func_wrapper.NativeDelegate, (IntPtr) gch, DestroyHelper.NotifyHandler);
}

View file

@ -14,6 +14,7 @@ sources = \
Application.cs \
BindingAttribute.cs \
ChildPropertyAttribute.cs \
DestroyHelper.cs \
ITreeNode.cs \
NodeCellDataFunc.cs \
NodeSelection.cs \

View file

@ -46,8 +46,7 @@
[Obsolete ("Replaced by ToolItem API")]
public Gtk.Widget AppendElement (Gtk.ToolbarChildType type, Gtk.Widget widget, string text, string tooltip_text, string tooltip_private_text, Gtk.Widget icon, Gtk.SignalFunc cb)
{
GtkSharp.SignalFuncWrapper cb_wrapper = null;
cb_wrapper = new GtkSharp.SignalFuncWrapper (cb);
GtkSharp.SignalFuncWrapper cb_wrapper = new GtkSharp.SignalFuncWrapper (cb);
IntPtr ntext = GLib.Marshaller.StringToPtrGStrdup (text);
IntPtr ntiptext = GLib.Marshaller.StringToPtrGStrdup (tooltip_text);
IntPtr ntipprivtext = GLib.Marshaller.StringToPtrGStrdup (tooltip_private_text);
@ -71,8 +70,7 @@
[Obsolete ("Replaced by ToolItem API")]
public Gtk.Widget InsertElement (Gtk.ToolbarChildType type, Gtk.Widget widget, string text, string tooltip_text, string tooltip_private_text, Gtk.Widget icon, Gtk.SignalFunc cb, IntPtr user_data, int position)
{
GtkSharp.SignalFuncWrapper cb_wrapper = null;
cb_wrapper = new GtkSharp.SignalFuncWrapper (cb);
GtkSharp.SignalFuncWrapper cb_wrapper = new GtkSharp.SignalFuncWrapper (cb);
IntPtr ntext = GLib.Marshaller.StringToPtrGStrdup (text);
IntPtr ntiptext = GLib.Marshaller.StringToPtrGStrdup (tooltip_text);
IntPtr ntipprivtext = GLib.Marshaller.StringToPtrGStrdup (tooltip_private_text);
@ -97,8 +95,7 @@
[Obsolete ("Replaced by ToolItem API")]
public Gtk.Widget PrependElement (Gtk.ToolbarChildType type, Gtk.Widget widget, string text, string tooltip_text, string tooltip_private_text, Gtk.Widget icon, Gtk.SignalFunc cb)
{
GtkSharp.SignalFuncWrapper cb_wrapper = null;
cb_wrapper = new GtkSharp.SignalFuncWrapper (cb);
GtkSharp.SignalFuncWrapper cb_wrapper = new GtkSharp.SignalFuncWrapper (cb);
IntPtr ntext = GLib.Marshaller.StringToPtrGStrdup (text);
IntPtr ntiptext = GLib.Marshaller.StringToPtrGStrdup (tooltip_text);
IntPtr ntipprivtext = GLib.Marshaller.StringToPtrGStrdup (tooltip_private_text);
@ -122,8 +119,7 @@
[Obsolete ("Replaced by ToolItem API")]
public Gtk.Widget AppendItem (string text, string tooltip_text, string tooltip_private_text, Gtk.Widget icon, Gtk.SignalFunc cb)
{
GtkSharp.SignalFuncWrapper cb_wrapper = null;
cb_wrapper = new GtkSharp.SignalFuncWrapper (cb);
GtkSharp.SignalFuncWrapper cb_wrapper = new GtkSharp.SignalFuncWrapper (cb);
IntPtr ntext = GLib.Marshaller.StringToPtrGStrdup (text);
IntPtr ntiptext = GLib.Marshaller.StringToPtrGStrdup (tooltip_text);
IntPtr ntipprivtext = GLib.Marshaller.StringToPtrGStrdup (tooltip_private_text);
@ -147,8 +143,7 @@
[Obsolete ("Replaced by ToolItem API")]
public Gtk.Widget InsertItem (string text, string tooltip_text, string tooltip_private_text, Gtk.Widget icon, Gtk.SignalFunc cb, IntPtr user_data, int position)
{
GtkSharp.SignalFuncWrapper cb_wrapper = null;
cb_wrapper = new GtkSharp.SignalFuncWrapper (cb);
GtkSharp.SignalFuncWrapper cb_wrapper = new GtkSharp.SignalFuncWrapper (cb);
IntPtr ntext = GLib.Marshaller.StringToPtrGStrdup (text);
IntPtr ntiptext = GLib.Marshaller.StringToPtrGStrdup (tooltip_text);
IntPtr ntipprivtext = GLib.Marshaller.StringToPtrGStrdup (tooltip_private_text);
@ -172,8 +167,7 @@
[Obsolete ("Replaced by ToolItem API")]
public Gtk.Widget PrependItem (string text, string tooltip_text, string tooltip_private_text, Gtk.Widget icon, Gtk.SignalFunc cb)
{
GtkSharp.SignalFuncWrapper cb_wrapper = null;
cb_wrapper = new GtkSharp.SignalFuncWrapper (cb);
GtkSharp.SignalFuncWrapper cb_wrapper = new GtkSharp.SignalFuncWrapper (cb);
IntPtr ntext = GLib.Marshaller.StringToPtrGStrdup (text);
IntPtr ntiptext = GLib.Marshaller.StringToPtrGStrdup (tooltip_text);
IntPtr ntipprivtext = GLib.Marshaller.StringToPtrGStrdup (tooltip_private_text);
@ -203,8 +197,7 @@
[Obsolete ("Replaced by ToolItem API")]
public Gtk.Widget InsertStock (string stock_id, string tooltip_text, string tooltip_private_text, Gtk.SignalFunc cb, IntPtr user_data, int position)
{
GtkSharp.SignalFuncWrapper cb_wrapper = null;
cb_wrapper = new GtkSharp.SignalFuncWrapper (cb);
GtkSharp.SignalFuncWrapper cb_wrapper = new GtkSharp.SignalFuncWrapper (cb);
IntPtr nstock = GLib.Marshaller.StringToPtrGStrdup (stock_id);
IntPtr ntiptext = GLib.Marshaller.StringToPtrGStrdup (tooltip_text);
IntPtr ntipprivtext = GLib.Marshaller.StringToPtrGStrdup (tooltip_private_text);

View file

@ -58,53 +58,35 @@
return ret;
}
[GLib.CDeclCallback]
delegate void DestroyNotify (IntPtr data);
static void ReleaseCallback (IntPtr data)
{
if (data == IntPtr.Zero)
return;
GCHandle gch = (GCHandle) data;
gch.Free ();
}
static DestroyNotify release_callback;
[DllImport("libgtk-win32-2.0-0.dll")]
static extern void gtk_tree_model_filter_set_visible_func (IntPtr raw, GtkSharp.TreeModelFilterVisibleFuncNative func, IntPtr data, GtkSharp.DestroyNotifyNative destroy);
[Obsolete ("Replaced by SetVisibleFunc (TreeModelFilterVisibleFunc) overload.")]
public void SetVisibleFunc (TreeModelFilterVisibleFunc func, IntPtr data, Gtk.DestroyNotify destroy)
{
GtkSharp.TreeModelFilterVisibleFuncWrapper func_wrapper = new GtkSharp.TreeModelFilterVisibleFuncWrapper (func);
GtkSharp.DestroyNotifyWrapper destroy_wrapper = new GtkSharp.DestroyNotifyWrapper (destroy);
gtk_tree_model_filter_set_visible_func (Handle, func_wrapper.NativeDelegate, data, destroy_wrapper.NativeDelegate);
SetVisibleFunc (func);
}
[DllImport("libgtk-win32-2.0-0.dll")]
static extern void gtk_tree_model_filter_set_visible_func (IntPtr raw, GtkSharp.TreeModelFilterVisibleFuncNative func, IntPtr data, DestroyNotify destroy);
static extern void gtk_tree_model_filter_set_visible_func (IntPtr raw, GtkSharp.TreeModelFilterVisibleFuncNative func, IntPtr data, NativeDestroyNotify destroy);
public void SetVisibleFunc (TreeModelFilterVisibleFunc func)
{
if (func == null) {
gtk_tree_model_filter_set_visible_func (Handle, null, IntPtr.Zero, null);
return;
}
GtkSharp.TreeModelFilterVisibleFuncWrapper func_wrapper = new GtkSharp.TreeModelFilterVisibleFuncWrapper (func);
if (release_callback == null)
release_callback = new DestroyNotify (ReleaseCallback);
GCHandle gch = GCHandle.Alloc (func_wrapper);
gtk_tree_model_filter_set_visible_func (Handle, func_wrapper.NativeDelegate, (IntPtr) gch, release_callback);
gtk_tree_model_filter_set_visible_func (Handle, func_wrapper.NativeDelegate, (IntPtr) gch, DestroyHelper.NotifyHandler);
}
[DllImport("libgtk-win32-2.0-0.dll")]
static extern void gtk_tree_model_filter_set_modify_func(IntPtr raw, int n_columns, IntPtr[] types, GtkSharp.TreeModelFilterModifyFuncNative func, IntPtr data, DestroyNotify destroy);
static extern void gtk_tree_model_filter_set_modify_func(IntPtr raw, int n_columns, IntPtr[] types, GtkSharp.TreeModelFilterModifyFuncNative func, IntPtr data, NativeDestroyNotify destroy);
public void SetModifyFunc (int n_columns, GLib.GType[] types, TreeModelFilterModifyFunc func)
{
GtkSharp.TreeModelFilterModifyFuncWrapper func_wrapper = new GtkSharp.TreeModelFilterModifyFuncWrapper (func);
if (release_callback == null)
release_callback = new DestroyNotify (ReleaseCallback);
IntPtr[] native_types = new IntPtr [types.Length];
for (int i = 0; i < types.Length; i++)
native_types [i] = types [i].Val;
GCHandle gch = GCHandle.Alloc (func_wrapper);
gtk_tree_model_filter_set_modify_func (Handle, n_columns, native_types, func_wrapper.NativeDelegate, (IntPtr) gch, release_callback);
gtk_tree_model_filter_set_modify_func (Handle, n_columns, native_types, func_wrapper.NativeDelegate, (IntPtr) gch, DestroyHelper.NotifyHandler);
}

View file

@ -86,44 +86,44 @@
}
[DllImport("libgtk-win32-2.0-0.dll")]
static extern void gtk_tree_sortable_set_default_sort_func(IntPtr raw, IntPtr sort_func, IntPtr user_data, IntPtr destroy);
[DllImport("libgtk-win32-2.0-0.dll")]
static extern void gtk_tree_sortable_set_default_sort_func(IntPtr raw, GtkSharp.TreeIterCompareFuncNative sort_func, IntPtr user_data, GtkSharp.DestroyNotifyNative destroy);
public void SetDefaultSortFunc (TreeIterCompareFunc sort_func, IntPtr user_data, Gtk.DestroyNotify destroy)
{
if (sort_func == null) {
PersistentData ["default_sort_func"] = null;
gtk_tree_sortable_set_default_sort_func (Handle, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero);
return;
}
GtkSharp.TreeIterCompareFuncWrapper sort_func_wrapper = new GtkSharp.TreeIterCompareFuncWrapper (sort_func);
PersistentData ["default_sort_func"] = sort_func_wrapper;
GtkSharp.DestroyNotifyWrapper destroy_wrapper = null;
destroy_wrapper = new GtkSharp.DestroyNotifyWrapper (destroy);
gtk_tree_sortable_set_default_sort_func(Handle, sort_func_wrapper.NativeDelegate, user_data, destroy_wrapper.NativeDelegate);
}
[DllImport("libgtk-win32-2.0-0.dll")]
static extern void gtk_tree_sortable_set_sort_func(IntPtr raw, int col_id, IntPtr sort_func, IntPtr user_data, IntPtr destroy);
[DllImport("libgtk-win32-2.0-0.dll")]
static extern void gtk_tree_sortable_set_sort_func(IntPtr raw, int col_id, GtkSharp.TreeIterCompareFuncNative sort_func, IntPtr user_data, GtkSharp.DestroyNotifyNative destroy);
static extern void gtk_tree_sortable_set_sort_func(IntPtr raw, int col_id, GtkSharp.TreeIterCompareFuncNative sort_func, IntPtr user_data, NativeDestroyNotify destroy);
[Obsolete ("Replaced by SetSortFunc (int, TreeIterCompareFunc) overload.")]
public void SetSortFunc (int sort_column_id, TreeIterCompareFunc sort_func, IntPtr user_data, Gtk.DestroyNotify destroy)
{
SetSortFunc (sort_column_id, sort_func);
}
public void SetSortFunc (int sort_column_id, TreeIterCompareFunc sort_func)
{
if (sort_func == null) {
PersistentData ["column_" + sort_column_id + "_sort_func"] = null;
gtk_tree_sortable_set_sort_func (Handle, sort_column_id, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero);
gtk_tree_sortable_set_sort_func (Handle, sort_column_id, null, IntPtr.Zero, null);
return;
}
GtkSharp.TreeIterCompareFuncWrapper sort_func_wrapper = new GtkSharp.TreeIterCompareFuncWrapper (sort_func);
PersistentData ["column_" + sort_column_id + "_sort_func"] = sort_func_wrapper;
GtkSharp.DestroyNotifyWrapper destroy_wrapper = null;
destroy_wrapper = new GtkSharp.DestroyNotifyWrapper (destroy);
gtk_tree_sortable_set_sort_func(Handle, sort_column_id, sort_func_wrapper.NativeDelegate, user_data, destroy_wrapper.NativeDelegate);
GCHandle gch = GCHandle.Alloc (sort_func_wrapper);
gtk_tree_sortable_set_sort_func(Handle, sort_column_id, sort_func_wrapper.NativeDelegate, (IntPtr) gch, DestroyHelper.NotifyHandler);
}
[DllImport("libgtk-win32-2.0-0.dll")]
static extern void gtk_tree_sortable_set_default_sort_func(IntPtr raw, GtkSharp.TreeIterCompareFuncNative sort_func, IntPtr user_data, NativeDestroyNotify destroy);
[Obsolete ("Replaced by SetDefaultSortFunc (TreeIterCompareFunc) overload.")]
public void SetDefaultSortFunc (TreeIterCompareFunc sort_func, IntPtr user_data, Gtk.DestroyNotify destroy)
{
SetDefaultSortFunc (sort_func);
}
public void SetDefaultSortFunc (TreeIterCompareFunc sort_func)
{
if (sort_func == null) {
gtk_tree_sortable_set_default_sort_func (Handle, null, IntPtr.Zero, null);
return;
}
GtkSharp.TreeIterCompareFuncWrapper sort_func_wrapper = new GtkSharp.TreeIterCompareFuncWrapper (sort_func);
GCHandle gch = GCHandle.Alloc (sort_func_wrapper);
gtk_tree_sortable_set_default_sort_func(Handle, sort_func_wrapper.NativeDelegate, (IntPtr) gch, DestroyHelper.NotifyHandler);
}

View file

@ -20,7 +20,13 @@
// Free Software Foundation, Inc., 59 Temple Place - Suite 330,
// Boston, MA 02111-1307, USA.
[Obsolete ("Replaced by SetDefaultSortFunc (TreeIterCompareFunc) overload.")]
void SetDefaultSortFunc (TreeIterCompareFunc sort_func, IntPtr user_data, Gtk.DestroyNotify destroy);
void SetDefaultSortFunc (TreeIterCompareFunc sort_func);
[Obsolete ("Replaced by SetSortFunc (int, TreeIterCompareFunc) overload.")]
void SetSortFunc (int sort_column_id, TreeIterCompareFunc sort_func, IntPtr user_data, Gtk.DestroyNotify destroy);
void SetSortFunc (int sort_column_id, TreeIterCompareFunc sort_func);

View file

@ -326,44 +326,44 @@
}
[DllImport("libgtk-win32-2.0-0.dll")]
static extern void gtk_tree_sortable_set_default_sort_func(IntPtr raw, IntPtr sort_func, IntPtr user_data, IntPtr destroy);
[DllImport("libgtk-win32-2.0-0.dll")]
static extern void gtk_tree_sortable_set_default_sort_func(IntPtr raw, GtkSharp.TreeIterCompareFuncNative sort_func, IntPtr user_data, GtkSharp.DestroyNotifyNative destroy);
public void SetDefaultSortFunc (TreeIterCompareFunc sort_func, IntPtr user_data, Gtk.DestroyNotify destroy)
{
if (sort_func == null) {
PersistentData ["default_sort_func"] = null;
gtk_tree_sortable_set_default_sort_func (Handle, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero);
return;
}
GtkSharp.TreeIterCompareFuncWrapper sort_func_wrapper = new GtkSharp.TreeIterCompareFuncWrapper (sort_func);
PersistentData ["default_sort_func"] = sort_func_wrapper;
GtkSharp.DestroyNotifyWrapper destroy_wrapper = null;
destroy_wrapper = new GtkSharp.DestroyNotifyWrapper (destroy);
gtk_tree_sortable_set_default_sort_func(Handle, sort_func_wrapper.NativeDelegate, user_data, destroy_wrapper.NativeDelegate);
}
[DllImport("libgtk-win32-2.0-0.dll")]
static extern void gtk_tree_sortable_set_sort_func(IntPtr raw, int col_id, IntPtr sort_func, IntPtr user_data, IntPtr destroy);
[DllImport("libgtk-win32-2.0-0.dll")]
static extern void gtk_tree_sortable_set_sort_func(IntPtr raw, int col_id, GtkSharp.TreeIterCompareFuncNative sort_func, IntPtr user_data, GtkSharp.DestroyNotifyNative destroy);
static extern void gtk_tree_sortable_set_sort_func(IntPtr raw, int col_id, GtkSharp.TreeIterCompareFuncNative sort_func, IntPtr user_data, NativeDestroyNotify destroy);
[Obsolete ("Replaced by SetSortFunc (int, TreeIterCompareFunc) overload.")]
public void SetSortFunc (int sort_column_id, TreeIterCompareFunc sort_func, IntPtr user_data, Gtk.DestroyNotify destroy)
{
SetSortFunc (sort_column_id, sort_func);
}
public void SetSortFunc (int sort_column_id, TreeIterCompareFunc sort_func)
{
if (sort_func == null) {
PersistentData ["column_" + sort_column_id + "_sort_func"] = null;
gtk_tree_sortable_set_sort_func (Handle, sort_column_id, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero);
gtk_tree_sortable_set_sort_func (Handle, sort_column_id, null, IntPtr.Zero, null);
return;
}
GtkSharp.TreeIterCompareFuncWrapper sort_func_wrapper = new GtkSharp.TreeIterCompareFuncWrapper (sort_func);
PersistentData ["column_" + sort_column_id + "_sort_func"] = sort_func_wrapper;
GtkSharp.DestroyNotifyWrapper destroy_wrapper = null;
destroy_wrapper = new GtkSharp.DestroyNotifyWrapper (destroy);
gtk_tree_sortable_set_sort_func(Handle, sort_column_id, sort_func_wrapper.NativeDelegate, user_data, destroy_wrapper.NativeDelegate);
GCHandle gch = GCHandle.Alloc (sort_func_wrapper);
gtk_tree_sortable_set_sort_func(Handle, sort_column_id, sort_func_wrapper.NativeDelegate, (IntPtr) gch, DestroyHelper.NotifyHandler);
}
[DllImport("libgtk-win32-2.0-0.dll")]
static extern void gtk_tree_sortable_set_default_sort_func(IntPtr raw, GtkSharp.TreeIterCompareFuncNative sort_func, IntPtr user_data, NativeDestroyNotify destroy);
[Obsolete ("Replaced by SetDefaultSortFunc (TreeIterCompareFunc) overload.")]
public void SetDefaultSortFunc (TreeIterCompareFunc sort_func, IntPtr user_data, Gtk.DestroyNotify destroy)
{
SetDefaultSortFunc (sort_func);
}
public void SetDefaultSortFunc (TreeIterCompareFunc sort_func)
{
if (sort_func == null) {
gtk_tree_sortable_set_default_sort_func (Handle, null, IntPtr.Zero, null);
return;
}
GtkSharp.TreeIterCompareFuncWrapper sort_func_wrapper = new GtkSharp.TreeIterCompareFuncWrapper (sort_func);
GCHandle gch = GCHandle.Alloc (sort_func_wrapper);
gtk_tree_sortable_set_default_sort_func(Handle, sort_func_wrapper.NativeDelegate, (IntPtr) gch, DestroyHelper.NotifyHandler);
}

View file

@ -66,61 +66,51 @@
}
}
Hashtable CellDataFuncs {
get {
if (PersistentData ["gtksharp_cell_data_funcs"] == null)
PersistentData ["gtksharp_cell_data_funcs"] = new Hashtable ();
return PersistentData ["gtksharp_cell_data_funcs"] as Hashtable;
}
}
[DllImport("libgtk-win32-2.0-0.dll")]
static extern void gtk_tree_view_column_set_cell_data_func (IntPtr raw, IntPtr cell_renderer, GtkSharp.TreeCellDataFuncNative func, IntPtr func_data, NativeDestroyNotify destroy);
[DllImport("libgtk-win32-2.0-0.dll")]
static extern void gtk_tree_view_column_set_cell_data_func(IntPtr raw, IntPtr cell_renderer, IntPtr func, IntPtr func_data, IntPtr destroy);
private void ReleaseDataFunc (CellRenderer cell)
{
CellDataFuncs [cell.Handle] = null;
gtk_tree_view_column_set_cell_data_func(Handle, cell.Handle, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero);
}
[DllImport("libgtk-win32-2.0-0.dll")]
static extern void gtk_tree_view_column_set_cell_data_func(IntPtr raw, IntPtr cell_renderer, GtkSharp.TreeCellDataFuncNative func, IntPtr func_data, IntPtr destroy);
[DllImport("libgtk-win32-2.0-0.dll")]
static extern void gtk_tree_view_column_set_cell_data_func(IntPtr raw, IntPtr cell_renderer, GtkSharp.CellLayoutDataFuncNative func, IntPtr func_data, IntPtr destroy);
static extern void gtk_tree_view_column_set_cell_data_func (IntPtr raw, IntPtr cell_renderer, GtkSharp.CellLayoutDataFuncNative func, IntPtr func_data, NativeDestroyNotify destroy);
public void SetCellDataFunc (CellRenderer cell_renderer, TreeCellDataFunc func)
{
if (func == null) {
ReleaseDataFunc (cell_renderer);
gtk_tree_view_column_set_cell_data_func (Handle, cell_renderer == null ? IntPtr.Zero : cell_renderer.Handle, (GtkSharp.TreeCellDataFuncNative) null, IntPtr.Zero, null);
return;
}
;
GtkSharp.TreeCellDataFuncWrapper wrapper = new GtkSharp.TreeCellDataFuncWrapper (func);
CellDataFuncs [cell_renderer.Handle] = wrapper;
gtk_tree_view_column_set_cell_data_func(Handle, cell_renderer.Handle, wrapper.NativeDelegate, IntPtr.Zero, IntPtr.Zero);
}
public void SetCellDataFunc (CellRenderer cell_renderer, CellLayoutDataFunc func)
{
if (func == null) {
ReleaseDataFunc (cell_renderer);
return;
}
;
GtkSharp.CellLayoutDataFuncWrapper wrapper = new GtkSharp.CellLayoutDataFuncWrapper (func);
CellDataFuncs [cell_renderer.Handle] = wrapper;
gtk_tree_view_column_set_cell_data_func(Handle, cell_renderer.Handle, wrapper.NativeDelegate, IntPtr.Zero, IntPtr.Zero);
GCHandle gch = GCHandle.Alloc (wrapper);
gtk_tree_view_column_set_cell_data_func (Handle, cell_renderer == null ? IntPtr.Zero : cell_renderer.Handle, wrapper.NativeDelegate, (IntPtr) gch, DestroyHelper.NotifyHandler);
}
public void SetCellDataFunc (CellRenderer cell_renderer, NodeCellDataFunc func)
public void SetCellDataFunc (CellRenderer cell_renderer, CellLayoutDataFunc func)
{
if (func == null) {
ReleaseDataFunc (cell_renderer);
gtk_tree_view_column_set_cell_data_func (Handle, cell_renderer == null ? IntPtr.Zero : cell_renderer.Handle, (GtkSharp.TreeCellDataFuncNative) null, IntPtr.Zero, null);
return;
}
;
NodeCellDataFuncWrapper wrapper = new NodeCellDataFuncWrapper (func);
CellDataFuncs [cell_renderer.Handle] = wrapper;
gtk_tree_view_column_set_cell_data_func(Handle, cell_renderer.Handle, wrapper.NativeDelegate, IntPtr.Zero, IntPtr.Zero);
GtkSharp.CellLayoutDataFuncWrapper func_wrapper = new GtkSharp.CellLayoutDataFuncWrapper (func);
GCHandle gch = GCHandle.Alloc (func_wrapper);
gtk_tree_view_column_set_cell_data_func (Handle, cell_renderer == null ? IntPtr.Zero : cell_renderer.Handle, func_wrapper.NativeDelegate, (IntPtr) gch, DestroyHelper.NotifyHandler);
}
public void SetCellDataFunc (CellRenderer cell_renderer, NodeCellDataFunc func)
{
if (func == null) {
gtk_tree_view_column_set_cell_data_func (Handle, cell_renderer == null ? IntPtr.Zero : cell_renderer.Handle, (GtkSharp.TreeCellDataFuncNative) null, IntPtr.Zero, null);
return;
}
NodeCellDataFuncWrapper func_wrapper = new NodeCellDataFuncWrapper (func);
GCHandle gch = GCHandle.Alloc (func_wrapper);
gtk_tree_view_column_set_cell_data_func (Handle, cell_renderer == null ? IntPtr.Zero : cell_renderer.Handle, func_wrapper.NativeDelegate, (IntPtr) gch, DestroyHelper.NotifyHandler);
}
[Obsolete ("Replaced by SetCellDataFunc (CellRenderer, TreeCellDataFunc) overload")]
public void SetCellDataFunc (Gtk.CellRenderer cell_renderer, Gtk.TreeCellDataFunc func, IntPtr func_data, Gtk.DestroyNotify destroy)
{
SetCellDataFunc (cell_renderer, func);
}