[Gtk-sharp-list] Patch for TreeView
Gonzalo Paniagua Javier
gonzalo@ximian.com
15 Apr 2003 07:14:24 +0200
--=-fN+NkgC/5kvmts2ePrHa
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
Hi there!
That attached patch adds a pass_as="out" for 2 arguments of
WidgetToTreeCoords, hides GetPathAtPos and adds 3 overloads for this one
that avoids the caller creating extra variables (possibly) not used.
Ok to commit?
-Gonzalo
--=-fN+NkgC/5kvmts2ePrHa
Content-Disposition: attachment; filename=entry
Content-Type: text/plain; name=entry; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
2003-04-15 Gonzalo Paniagua Javier <gonzalo@ximian.com>
* gtk/TreeView.custom:
(GetPathAtPos): added 3 overloads of this method so that the caller
does not need to create extra variables that may not use.
* api/gtk-api.xml:
* sources/Gtk.metadata: added pass_out attribute for tx and ty
arguments of TreeView::WidgetToTreeCoords. Hide TreeView::GetPathAtPos.
--=-fN+NkgC/5kvmts2ePrHa
Content-Disposition: attachment; filename=treeview.patch
Content-Type: text/x-patch; name=treeview.patch; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Index: api/gtk-api.xml
===================================================================
RCS file: /cvs/public/gtk-sharp/api/gtk-api.xml,v
retrieving revision 1.31
diff -u -r1.31 gtk-api.xml
--- api/gtk-api.xml 14 Apr 2003 17:04:13 -0000 1.31
+++ api/gtk-api.xml 15 Apr 2003 05:17:54 -0000
@@ -8166,7 +8166,7 @@
<method name="GetModel" cname="gtk_tree_view_get_model">
<return-type type="GtkTreeModel*"/>
</method>
- <method name="GetPathAtPos" cname="gtk_tree_view_get_path_at_pos">
+ <method name="GetPathAtPos" cname="gtk_tree_view_get_path_at_pos" hidden="1">
<return-type type="gboolean"/>
<parameters>
<parameter type="gint" name="x"/>
@@ -8409,8 +8409,8 @@
<parameters>
<parameter type="gint" name="wx"/>
<parameter type="gint" name="wy"/>
- <parameter type="gint*" name="tx"/>
- <parameter type="gint*" name="ty"/>
+ <parameter type="gint*" name="tx" pass_as="out"/>
+ <parameter type="gint*" name="ty" pass_as="out"/>
</parameters>
</method>
</object>
Index: gtk/TreeView.custom
===================================================================
RCS file: /cvs/public/gtk-sharp/gtk/TreeView.custom,v
retrieving revision 1.5
diff -u -r1.5 TreeView.custom
--- gtk/TreeView.custom 22 Feb 2003 04:34:56 -0000 1.5
+++ gtk/TreeView.custom 15 Apr 2003 05:17:55 -0000
@@ -1,8 +1,11 @@
// Gtk.TreeView.Custom - Gtk TreeView class customizations
//
-// Author: Kristian Rietveld <kris@gtk.org>
+// Authors:
+// Kristian Rietveld <kris@gtk.org>
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
//
// (c) 2002 Kristian Rietveld
+// (c) 2003 Ximian, Inc. (http://www.ximian.com)
//
// This code is inserted after the automatically generated code.
@@ -27,3 +30,68 @@
gtk_tree_view_set_model (Handle, value.Handle);
}
}
+
+ [DllImport("libgtk-win32-2.0-0.dll")]
+ static extern bool gtk_tree_view_get_path_at_pos (IntPtr raw,
+ int x,
+ int y,
+ out IntPtr path,
+ IntPtr column,
+ out int cell_x,
+ out int cell_y);
+
+ [DllImport("libgtk-win32-2.0-0.dll", EntryPoint="gtk_tree_view_get_path_at_pos")]
+ static extern bool gtk_tree_view_get_path_at_pos_intptr (IntPtr raw,
+ int x,
+ int y,
+ out IntPtr path,
+ IntPtr column,
+ IntPtr cell_x,
+ IntPtr cell_y);
+
+ public bool GetPathAtPos (int x, int y, out Gtk.TreePath path, Gtk.TreeViewColumn column, out int cell_x, out int cell_y)
+ {
+ IntPtr col;
+ if (column == null)
+ col = IntPtr.Zero;
+ else
+ col = column.Handle;
+
+ IntPtr pathHandle;
+ bool raw_ret = gtk_tree_view_get_path_at_pos (Handle, x, y, out pathHandle, col, out cell_x, out cell_y);
+ if (raw_ret)
+ path = new TreePath (pathHandle);
+ else
+ path = null;
+
+ return raw_ret;
+ }
+
+
+ public bool GetPathAtPos (int x, int y, out Gtk.TreePath path)
+ {
+ IntPtr pathHandle;
+ bool raw_ret = gtk_tree_view_get_path_at_pos_intptr (Handle, x, y, out pathHandle, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero);
+ if (raw_ret)
+ path = new TreePath (pathHandle);
+ else
+ path = null;
+
+ return raw_ret;
+ }
+
+ public bool GetPathAtPos (int x, int y, out Gtk.TreePath path, Gtk.TreeViewColumn column)
+ {
+ if (column == null)
+ return GetPathAtPos (x, y, out path);
+
+ IntPtr pathHandle;
+ bool raw_ret = gtk_tree_view_get_path_at_pos_intptr (Handle, x, y, out pathHandle, column.Handle, IntPtr.Zero, IntPtr.Zero);
+ if (raw_ret)
+ path = new TreePath (pathHandle);
+ else
+ path = null;
+
+ return raw_ret;
+ }
+
Index: sources/Gtk.metadata
===================================================================
RCS file: /cvs/public/gtk-sharp/sources/Gtk.metadata,v
retrieving revision 1.49
diff -u -r1.49 Gtk.metadata
--- sources/Gtk.metadata 14 Apr 2003 17:04:13 -0000 1.49
+++ sources/Gtk.metadata 15 Apr 2003 05:17:55 -0000
@@ -377,7 +377,23 @@
</attribute>
</data>
</rule>
-
+<rule>
+ <class name="GtkTreeView">
+ <method>WidgetToTreeCoords</method>
+ </class>
+ <data>
+ <attribute target="param">
+ <filter level="name">tx</filter>
+ <name>pass_as</name>
+ <value>out</value>
+ </attribute>
+ <attribute target="param">
+ <filter level="name">ty</filter>
+ <name>pass_as</name>
+ <value>out</value>
+ </attribute>
+ </data>
+</rule>
<!-- variable arguments -->
<rule>
@@ -1643,6 +1659,17 @@
<method>GetText</method>
<method>SetText</method>
<method>Set</method>
+ </class>
+ <data>
+ <attribute target="method">
+ <name>hidden</name>
+ <value>1</value>
+ </attribute>
+ </data>
+</rule>
+<rule>
+ <class name="GtkTreeView">
+ <method>GetPathAtPos</method>
</class>
<data>
<attribute target="method">
--=-fN+NkgC/5kvmts2ePrHa--