Hey,
Here is a patch to add an overload for TreeSelection.GetSelected (out
Gtk.TreeIter) so you don't have to keep creating models that you don't
care about in the instances where you already have the model lying
around.
Let me know if it is ok to commit.
--Todd
Index: gtk/TreeSelection.custom
===================================================================
--- gtk/TreeSelection.custom (revision 47458)
+++ gtk/TreeSelection.custom (working copy)
@@ -58,3 +58,11 @@
{
SelectFunction = func;
}
+
+ [DllImport("libgtk-win32-2.0-0.dll", EntryPoint="gtk_tree_selection_get_selected")]
+ static extern bool gtk_tree_selection_get_selected_without_model (IntPtr raw, IntPtr model, out Gtk.TreeIter iter);
+
+ public bool GetSelected (out Gtk.TreeIter iter)
+ {
+ return gtk_tree_selection_get_selected_without_model (Handle, IntPtr.Zero, out iter);
+ }
Index: doc/en/Gtk/TreeSelection.xml
===================================================================
--- doc/en/Gtk/TreeSelection.xml (revision 47458)
+++ doc/en/Gtk/TreeSelection.xml (working copy)
@@ -539,5 +539,21 @@
<since version="Gtk# 2.4" />
</Docs>
</Member>
+ <Member MemberName="GetSelected">
+ <MemberSignature Language="C#" Value="public bool GetSelected (out Gtk.TreeIter iter);" />
+ <MemberType>Method</MemberType>
+ <ReturnValue>
+ <ReturnType>System.Boolean</ReturnType>
+ </ReturnValue>
+ <Parameters>
+ <Parameter Name="iter" Type="Gtk.TreeIter&" RefType="out" />
+ </Parameters>
+ <Docs>
+ <param name="iter">The position that was selected.</param>
+ <summary>Gets information about the currently selected node.</summary>
+ <returns><see langword="true" /> if a row is selected.</returns>
+ <remarks>This convenience method doesnt require an out <see cref="Gtk.TreeModel" />. It is useful in the case that you already have a copy of the TreeModel.</remarks>
+ </Docs>
+ </Member>
</Members>
</Type>
Index: ChangeLog
===================================================================
--- ChangeLog (revision 47458)
+++ ChangeLog (working copy)
@@ -1,3 +1,10 @@
+2005-07-19 Todd Berman <[EMAIL PROTECTED]>
+
+ * gtk/TreeSelection.custom: Add an overload for GetSelected to remove
+ the need to always pass in that damn TreeModel.
+ * doc/en/Gtk/TreeSelection.xml: Add documentation for the new
+ overload.
+
2005-07-19 Dan Winship <[EMAIL PROTECTED]>
* generator/Parameters.cs: Remove the AllowComplexRefs flag.
_______________________________________________
Gtk-sharp-list maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/gtk-sharp-list