2007-11-16 Eskil Bylund <eskil@letterboxes.org>

* gtk/ListStore.custom:
	* gtk/TreeStore.custom: Implement InsertWithValues.
	* gtk/Gtk.metadata: Deprecate the old generated method.
	[Fixes #325040]

svn path=/trunk/gtk-sharp/; revision=89770
This commit is contained in:
Mike Kestner 2007-11-16 16:32:44 +00:00
parent bd9da3f412
commit 9897c07f21
6 changed files with 155 additions and 0 deletions

View file

@ -1,3 +1,10 @@
2007-11-16 Eskil Bylund <eskil@letterboxes.org>
* gtk/ListStore.custom:
* gtk/TreeStore.custom: Implement InsertWithValues.
* gtk/Gtk.metadata: Deprecate the old generated method.
[Fixes #325040]
2007-11-12 Mike Kestner <mkestner@novell.com>
* sample/TreeModelDemo.cs: lt/gt typo bugfix [Fixes #333653]

View file

@ -1581,5 +1581,30 @@ The above example creates a new three columns list store. The types of the colum
<since version="Gtk# 2.10" />
</Docs>
</Member>
<Member MemberName="InsertWithValues">
<MemberSignature Language="C#" Value="public Gtk.TreeIter InsertWithValues (int position, object[] values);" />
<MemberType>Method</MemberType>
<ReturnValue>
<ReturnType>Gtk.TreeIter</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="position" Type="System.Int32" />
<Parameter Name="values" Type="System.Object[]">
<Attributes>
<Attribute>
<AttributeName>System.ParamArray</AttributeName>
</Attribute>
</Attributes>
</Parameter>
</Parameters>
<Docs>
<param name="position">Insert position.</param>
<param name="values">An array of column values to set.</param>
<summary>Inserts a row into the store at a given position with column values.</summary>
<returns>An iter pointing to the inserted row.</returns>
<remarks>The values provided should be in column order.</remarks>
<since version="Gtk# 2.8" />
</Docs>
</Member>
</Members>
</Type>

View file

@ -1852,5 +1852,57 @@ store = new TreeStore (typeof (int), typeof (string));
<since version="Gtk# 2.10" />
</Docs>
</Member>
<Member MemberName="InsertWithValues">
<MemberSignature Language="C#" Value="public Gtk.TreeIter InsertWithValues (Gtk.TreeIter parent, int position, object[] values);" />
<MemberType>Method</MemberType>
<ReturnValue>
<ReturnType>Gtk.TreeIter</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="parent" Type="Gtk.TreeIter" />
<Parameter Name="position" Type="System.Int32" />
<Parameter Name="values" Type="System.Object[]">
<Attributes>
<Attribute>
<AttributeName>System.ParamArray</AttributeName>
</Attribute>
</Attributes>
</Parameter>
</Parameters>
<Docs>
<param name="parent">Iter of the node to insert into.</param>
<param name="position">Insert position.</param>
<param name="values">An array of column values.</param>
<summary>Inserts a child row into a node with values.</summary>
<returns>An iter pointing to the added row.</returns>
<remarks>The column values provided should be in column order.</remarks>
<since version="Gtk# 2.10" />
</Docs>
</Member>
<Member MemberName="InsertWithValues">
<MemberSignature Language="C#" Value="public Gtk.TreeIter InsertWithValues (int position, object[] values);" />
<MemberType>Method</MemberType>
<ReturnValue>
<ReturnType>Gtk.TreeIter</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="position" Type="System.Int32" />
<Parameter Name="values" Type="System.Object[]">
<Attributes>
<Attribute>
<AttributeName>System.ParamArray</AttributeName>
</Attribute>
</Attributes>
</Parameter>
</Parameters>
<Docs>
<param name="position">Insert position.</param>
<param name="values">An array of column values.</param>
<summary>Inserts a row into the Root node of the store with values.</summary>
<returns>An iter pointing to the added row.</returns>
<remarks>The column values provided should be in column order.</remarks>
<since version="Gtk# 2.10" />
</Docs>
</Member>
</Members>
</Type>

View file

@ -415,6 +415,8 @@
<attr path="/api/namespace/object[@cname='GtkListStore']/method[@name='InsertAfter']/*/*[@name='iter']" name="pass_as">out</attr>
<attr path="/api/namespace/object[@cname='GtkListStore']/method[@name='InsertBefore']/*/*[@name='iter']" name="pass_as">out</attr>
<attr path="/api/namespace/object[@cname='GtkListStore']/method[@name='Insert']/*/*[@name='iter']" name="pass_as">out</attr>
<attr path="/api/namespace/object[@cname='GtkListStore']/method[@name='InsertWithValues']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkListStore']/method[@name='InsertWithValuesv']" name="deprecated">1</attr>
<attr path="/api/namespace/object[@cname='GtkListStore']/method[@name='Prepend']/*/*[@name='iter']" name="pass_as">out</attr>
<attr path="/api/namespace/object[@cname='GtkListStore']/method[@name='Remove']/*/*[@name='iter']" name="pass_as">ref</attr>
<attr path="/api/namespace/object[@cname='GtkListStore']/method[@name='Set']" name="hidden">1</attr>
@ -618,6 +620,7 @@
<attr path="/api/namespace/object[@cname='GtkTreeStore']/method[@name='Append']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkTreeStore']/method[@name='InsertAfter']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkTreeStore']/method[@name='InsertBefore']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkTreeStore']/method[@name='InsertWithValues']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkTreeStore']/method[@name='InsertWithValuesv']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkTreeStore']/method[@name='Insert']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkTreeStore']/method[@name='Prepend']" name="hidden">1</attr>

View file

@ -117,6 +117,32 @@
return AppendValues ((Array) values);
}
[DllImport("libgtk-win32-2.0-0.dll")]
static extern void gtk_list_store_insert_with_valuesv(IntPtr raw, out TreeIter iter, int position, int[] columns, GLib.Value[] values, int n_values);
public TreeIter InsertWithValues (int position, params object[] values)
{
int[] columns = new int[values.Length];
GLib.Value[] vals = new GLib.Value[values.Length];
int n_values = 0;
for (int i = 0; i < values.Length; i++) {
if (values[i] != null) {
columns[n_values] = i;
vals[n_values] = new GLib.Value (values[i]);
n_values++;
}
}
TreeIter iter;
gtk_list_store_insert_with_valuesv (Handle, out iter, position, columns, vals, n_values);
for (int i = 0; i < n_values; i++)
vals[i].Dispose ();
return iter;
}
public ListStore (params GLib.GType[] types) : base (IntPtr.Zero)
{
CreateNativeObject (new string [0], new GLib.Value [0]);

View file

@ -293,6 +293,48 @@
return AppendValues ((Array) values);
}
[DllImport("libgtk-win32-2.0-0.dll")]
static extern void gtk_tree_store_insert_with_valuesv(IntPtr raw, out TreeIter iter, IntPtr parent, int position, int[] columns, GLib.Value[] values, int n_values);
[DllImport("libgtk-win32-2.0-0.dll")]
static extern void gtk_tree_store_insert_with_valuesv(IntPtr raw, out TreeIter iter, ref TreeIter parent, int position, int[] columns, GLib.Value[] values, int n_values);
public TreeIter InsertWithValues (int position, params object[] values)
{
return InsertWithValues(false, TreeIter.Zero, position, values);
}
public TreeIter InsertWithValues (TreeIter parent, int position, params object[] values)
{
return InsertWithValues(true, parent, position, values);
}
private TreeIter InsertWithValues (bool hasParent, TreeIter parent, int position, params object[] values)
{
int[] columns = new int[values.Length];
GLib.Value[] vals = new GLib.Value[values.Length];
int n_values = 0;
for (int i = 0; i < values.Length; i++) {
if (values[i] != null) {
columns[n_values] = i;
vals[n_values] = new GLib.Value (values[i]);
n_values++;
}
}
TreeIter iter;
if (hasParent)
gtk_tree_store_insert_with_valuesv (Handle, out iter, ref parent, position, columns, vals, n_values);
else
gtk_tree_store_insert_with_valuesv (Handle, out iter, IntPtr.Zero, position, columns, vals, n_values);
for (int i = 0; i < n_values; i++)
vals[i].Dispose ();
return iter;
}
public TreeStore (params GLib.GType[] types) : base (IntPtr.Zero)
{
CreateNativeObject (new string [0], new GLib.Value [0]);